diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs index 907d641..5ed7410 100644 --- a/src/ReC.Client/ReCClient.cs +++ b/src/ReC.Client/ReCClient.cs @@ -1,5 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using System; using System.Net.Http; using ReC.Client.Api; @@ -57,21 +58,23 @@ namespace ReC.Client /// Initializes a new instance of the class. /// /// The factory to create HttpClients. + /// An optional set of client options. Defaults are used when omitted. /// An optional logger used to record API call outcomes. #if NETFRAMEWORK - public ReCClient(IHttpClientFactory httpClientFactory, ILogger logger = null) + public ReCClient(IHttpClientFactory httpClientFactory, IOptions options = null, ILogger logger = null) #else - public ReCClient(IHttpClientFactory httpClientFactory, ILogger? logger = null) + public ReCClient(IHttpClientFactory httpClientFactory, IOptions? options = null, ILogger? logger = null) #endif { _http = httpClientFactory.CreateClient(ClientName); - RecActions = new RecActionApi(_http, logger); - Results = new ResultApi(_http, logger); - Profiles = new ProfileApi(_http, logger); - EndpointAuth = new EndpointAuthApi(_http, logger); - EndpointParams = new EndpointParamsApi(_http, logger); - Endpoints = new EndpointsApi(_http, logger); - Common = new CommonApi(_http, logger); + var opts = options?.Value ?? new ReCClientOptions(); + RecActions = new RecActionApi(_http, logger, opts); + Results = new ResultApi(_http, logger, opts); + Profiles = new ProfileApi(_http, logger, opts); + EndpointAuth = new EndpointAuthApi(_http, logger, opts); + EndpointParams = new EndpointParamsApi(_http, logger, opts); + Endpoints = new EndpointsApi(_http, logger, opts); + Common = new CommonApi(_http, logger, opts); } #region Static