Пример #1
0
        public EsiClient(EsiConfiguration configuration,
                         IRestClient restClient = null,
                         ILogger logger         = null)
        {
            _config     = configuration;
            this.logger = logger;
            if (restClient == null)
            {
                this.restClient = new EsiRestClient(configuration);
            }

            restClient = new EsiRestClient(configuration);

            restClient.AddHandler("application/json", serializer);
            restClient.AddHandler("text/json", serializer);
            restClient.AddHandler("text/x-json", serializer);
            restClient.AddHandler("text/javascript", serializer);
            restClient.AddHandler("*+json", serializer);
        }
        public EsiRestClient(EsiConfiguration configuration,
                             ILogger logger = null)
        {
            config      = configuration;
            this.logger = logger;

            BaseUrl = new Uri(config.BaseUrl);

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
            {
                ContractResolver = new DefaultContractResolver()
                {
                    NamingStrategy = new SnakeCaseNamingStrategy()
                }
            };

            AddHandler("application/json", serializer);
            AddHandler("text/json", serializer);
            AddHandler("text/x-json", serializer);
            AddHandler("text/javascript", serializer);
            AddHandler("*+json", serializer);
        }