Example #1
0
        /// <summary>
        /// Creates the API interface. Expects either an authentication cookie within
        /// the user supplied cookie jar or a subsequent call to
        /// QuizduellApi.LoginUser() or QuizduellApi.CreateUser().
        /// </summary>
        /// <param name="host"></param>
        /// <param name="cookies">Stores authentication tokens with each request made to the API</param>
        /// <param name="userAgent"></param>
        /// <param name="salt"></param>
        /// <param name="key"></param>
        public QuizDuellApi(string host, CookieContainer cookies = null, QuizDuellPlattform plattform = QuizDuellPlattform.ANDROID, string userAgent = "Quizduell A 1.3.2", string salt = "SQ2zgOTmQc8KXmBP", string key = "irETGpoJjG57rrSC")
        {
            // TODO: Create an instance of the config class, so we can deseriliaze the config data to a file at the end of the program run.
            Host = host;
            Plattform = plattform;
            Salt = salt;
            Key = key;
            UserAgent = userAgent;
            random = new Random();

            if (cookies != null)
            {
                Cookies = cookies;
                Client = new RestClient(userAgent, cookies);
            }
            else
            {
                Client = new RestClient(userAgent);
            }
        }
Example #2
0
 public QuizDuellApi(QuizDuellConfig config)
 {
     // TODO: Refactor the Properties so that they just wrap an instance of the config class.
     // NOTE: This way we can deserialize the config file at the end of program run and the user of the api does not have to deal with that.  --- Think about this first, does it make sense that the api deals with deserializisation of the config file?
     Host = config.Host;
     Salt = config.Salt;
     Key = config.Key;
     UserAgent = config.UserAgent;
     Plattform = config.Plattform;
     Cookies = config.Cookies;
     Client = new RestClient(UserAgent, Cookies);
     random = new Random();
 }