public static IServiceCollection AddMercuryClient(this IServiceCollection services, Action <MercuryClientSettings> configure) { var settings = new MercuryClientSettings(); configure(settings); services.AddSingleton(settings); services.AddSingleton <IMercuryClientFactory, MercuryClientFactory>(); services.AddHttpClient <IMercuryClient, MercuryClient>(config => { config.BaseAddress = new Uri(settings.BaseAddress); }); return(services); }
public MercuryClient(HttpClient httpClient, MercuryClientSettings settings) { this.httpClient = httpClient; this.settings = settings; }
public MercuryClientFactory(IHttpClientFactory httpClientFactory, MercuryClientSettings settings) { this.httpClientFactory = httpClientFactory; this.settings = settings; }