Example #1
0
        public WowClient(string baseUrl, IAuthenticator authenticator, int apiVersion, string application)
        {
            Client = new RestClient()
            {
                BaseUrl = baseUrl,
                UserAgent = "wow.ApiLibrary/" + application
            };

            Client.JsonSerializerSettings = new Newtonsoft.Json.JsonSerializerSettings
            {
                Error = (sender, e) =>
                {
                    Debug.WriteLine(e.ToString());
                },
                ConstructorHandling = Newtonsoft.Json.ConstructorHandling.AllowNonPublicDefaultConstructor
            };

            Client.AddHeader("api-version", apiVersion.ToString());
            authenticator.SetAuthentication(Client);
        }