interfax / interfax-dotnet

Fax send and receive in .NET with the InterFAX REST API
https://www.interfax.net/en/dev/dotnet
MIT License
8 stars 14 forks source link

How to set up proxy? #24

Closed NagashreeHS closed 4 years ago

NagashreeHS commented 4 years ago

We are using below code to connect. But we are not sure where to add proxy settings. Can you please help ?

        public void Initialise(HttpMessageHandler messageHandler = null, HttpClient httpClient = 
        null)
        {
        var username = _faxConfiguration.UserName;
        var password = _faxConfiguration.Password;
        if (string.IsNullOrEmpty(username))
            throw new ArgumentException($"{username} has not been set.");

        if (string.IsNullOrEmpty(password))
            throw new ArgumentException($"{password} has not been set.");

        Account = new Account(this);
        Inbound = new Inbound(this);
        Outbound = new Outbound(this);
        Documents = new Documents(this);

        HttpClient = messageHandler == null ? new HttpClient() : new HttpClient(messageHandler);
        HttpClient = httpClient ?? HttpClient;

        HttpClient.BaseAddress = new Uri($"https://rest.interfax.net/");
        HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        HttpClient.DefaultRequestHeaders.Add("Authorization",
            new List<string> { $"Basic {Utils.Base64Encode($"{username}:{password}")}" });

        JsonConvert.DefaultSettings = () =>
        {
            var settings = new JsonSerializerSettings();
            settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
            return settings;
        };
    }
ricky-shake-n-bake-bobby commented 4 years ago

The code above does not relate to this client/package. For developer support, please reach out to dev@interfax.net