public WhispirApiHttpMessageHandler(WhispirApiHttpClientOptions options, HttpMessageHandler innerHandler = null) { var basicAuthHandler = new BasicAuthenticatedHttpMessageHandler( new BasicAuthenticatedHttpClientOptions { UserId = options.Username, Password = options.Password }, innerHandler ); var customHeaderAuthHandler = new CustomHeaderAuthenticatedHttpMessageHandler( new CustomHeaderAuthenticatedHttpClientOptions { Name = "x-api-key", Value = options.ApiKey }, basicAuthHandler ); var queryStringAuthHandler = new QueryStringParameterAuthenticatedHttpMessageHandler( new QueryStringParameterAuthenticatedHttpClientOptions { Name = "apikey", Value = options.ApiKey }, customHeaderAuthHandler ); InnerHandler = queryStringAuthHandler; }
public static HttpClient GetClient(WhispirApiHttpClientOptions options, HttpMessageHandler innerHandler = null) { var msgHandler = new WhispirApiHttpMessageHandler(options, innerHandler); return(new HttpClient(msgHandler)); }