diff --git a/src/ReC.Client/Api/BaseCrudApi.cs b/src/ReC.Client/Api/BaseCrudApi.cs
index 3728b11..50e2b3d 100644
--- a/src/ReC.Client/Api/BaseCrudApi.cs
+++ b/src/ReC.Client/Api/BaseCrudApi.cs
@@ -30,21 +30,28 @@ namespace ReC.Client.Api
protected readonly ILogger? Logger;
#endif
+ ///
+ /// The options controlling client behavior. Never .
+ ///
+ protected readonly ReCClientOptions Options;
+
///
/// Initializes a new instance of the class.
///
/// The HTTP client used for requests.
/// The base resource path for the API endpoint.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- protected BaseCrudApi(HttpClient http, string resourcePath, ILogger logger = null)
+ protected BaseCrudApi(HttpClient http, string resourcePath, ILogger logger = null, ReCClientOptions options = null)
#else
- protected BaseCrudApi(HttpClient http, string resourcePath, ILogger? logger = null)
+ protected BaseCrudApi(HttpClient http, string resourcePath, ILogger? logger = null, ReCClientOptions? options = null)
#endif
{
Http = http ?? throw new ArgumentNullException(nameof(http));
ResourcePath = resourcePath ?? throw new ArgumentNullException(nameof(resourcePath));
Logger = logger;
+ Options = options ?? new ReCClientOptions();
}
///
@@ -59,7 +66,7 @@ namespace ReC.Client.Api
using (var content = ReCClientHelpers.ToJsonContent(payload))
using (var resp = await Http.PostAsync(ResourcePath, content, cancel))
{
- await ReCClientHelpers.HandleResponseAsync(resp, Logger, cancel).ConfigureAwait(false);
+ await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
}
}
@@ -76,7 +83,7 @@ namespace ReC.Client.Api
using (var content = ReCClientHelpers.ToJsonContent(payload))
using (var resp = await Http.PutAsync($"{ResourcePath}/{id}", content, cancel))
{
- await ReCClientHelpers.HandleResponseAsync(resp, Logger, cancel).ConfigureAwait(false);
+ await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
}
}
@@ -95,7 +102,7 @@ namespace ReC.Client.Api
})
using (var resp = await Http.SendAsync(request, cancel))
{
- await ReCClientHelpers.HandleResponseAsync(resp, Logger, cancel).ConfigureAwait(false);
+ await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
}
}
}
diff --git a/src/ReC.Client/Api/CommonApi.cs b/src/ReC.Client/Api/CommonApi.cs
index d66b01b..86ddc67 100644
--- a/src/ReC.Client/Api/CommonApi.cs
+++ b/src/ReC.Client/Api/CommonApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public CommonApi(HttpClient http, ILogger logger = null) : base(http, "api/Common", logger)
+ public CommonApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/Common", logger, options)
#else
- public CommonApi(HttpClient http, ILogger? logger = null) : base(http, "api/Common", logger)
+ public CommonApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/Common", logger, options)
#endif
{
}
diff --git a/src/ReC.Client/Api/EndpointAuthApi.cs b/src/ReC.Client/Api/EndpointAuthApi.cs
index 14fb041..c0c197c 100644
--- a/src/ReC.Client/Api/EndpointAuthApi.cs
+++ b/src/ReC.Client/Api/EndpointAuthApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public EndpointAuthApi(HttpClient http, ILogger logger = null) : base(http, "api/EndpointAuth", logger)
+ public EndpointAuthApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/EndpointAuth", logger, options)
#else
- public EndpointAuthApi(HttpClient http, ILogger? logger = null) : base(http, "api/EndpointAuth", logger)
+ public EndpointAuthApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/EndpointAuth", logger, options)
#endif
{
}
diff --git a/src/ReC.Client/Api/EndpointParamsApi.cs b/src/ReC.Client/Api/EndpointParamsApi.cs
index f02224b..4a9fda0 100644
--- a/src/ReC.Client/Api/EndpointParamsApi.cs
+++ b/src/ReC.Client/Api/EndpointParamsApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public EndpointParamsApi(HttpClient http, ILogger logger = null) : base(http, "api/EndpointParams", logger)
+ public EndpointParamsApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/EndpointParams", logger, options)
#else
- public EndpointParamsApi(HttpClient http, ILogger? logger = null) : base(http, "api/EndpointParams", logger)
+ public EndpointParamsApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/EndpointParams", logger, options)
#endif
{
}
diff --git a/src/ReC.Client/Api/EndpointsApi.cs b/src/ReC.Client/Api/EndpointsApi.cs
index 0d70339..7e81e8f 100644
--- a/src/ReC.Client/Api/EndpointsApi.cs
+++ b/src/ReC.Client/Api/EndpointsApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public EndpointsApi(HttpClient http, ILogger logger = null) : base(http, "api/Endpoints", logger)
+ public EndpointsApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/Endpoints", logger, options)
#else
- public EndpointsApi(HttpClient http, ILogger? logger = null) : base(http, "api/Endpoints", logger)
+ public EndpointsApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/Endpoints", logger, options)
#endif
{
}
diff --git a/src/ReC.Client/Api/ProfileApi.cs b/src/ReC.Client/Api/ProfileApi.cs
index ea174e5..f5f9100 100644
--- a/src/ReC.Client/Api/ProfileApi.cs
+++ b/src/ReC.Client/Api/ProfileApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public ProfileApi(HttpClient http, ILogger logger = null) : base(http, "api/Profile", logger)
+ public ProfileApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/Profile", logger, options)
#else
- public ProfileApi(HttpClient http, ILogger? logger = null) : base(http, "api/Profile", logger)
+ public ProfileApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/Profile", logger, options)
#endif
{
}
diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs
index 6aed328..8d2b387 100644
--- a/src/ReC.Client/Api/RecActionApi.cs
+++ b/src/ReC.Client/Api/RecActionApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public RecActionApi(HttpClient http, ILogger logger = null) : base(http, "api/RecAction", logger)
+ public RecActionApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/RecAction", logger, options)
#else
- public RecActionApi(HttpClient http, ILogger? logger = null) : base(http, "api/RecAction", logger)
+ public RecActionApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/RecAction", logger, options)
#endif
{
}
@@ -36,7 +37,7 @@ namespace ReC.Client.Api
using (content)
using (var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken))
{
- await ReCClientHelpers.HandleResponseAsync(resp, Logger, cancellationToken).ConfigureAwait(false);
+ await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/ReC.Client/Api/ResultApi.cs b/src/ReC.Client/Api/ResultApi.cs
index abced0c..ceb2681 100644
--- a/src/ReC.Client/Api/ResultApi.cs
+++ b/src/ReC.Client/Api/ResultApi.cs
@@ -15,10 +15,11 @@ namespace ReC.Client.Api
///
/// The HTTP client used for requests.
/// An optional logger used to record API call outcomes.
+ /// An optional set of client options. Defaults are used when omitted.
#if NETFRAMEWORK
- public ResultApi(HttpClient http, ILogger logger = null) : base(http, "api/Result", logger)
+ public ResultApi(HttpClient http, ILogger logger = null, ReCClientOptions options = null) : base(http, "api/Result", logger, options)
#else
- public ResultApi(HttpClient http, ILogger? logger = null) : base(http, "api/Result", logger)
+ public ResultApi(HttpClient http, ILogger? logger = null, ReCClientOptions? options = null) : base(http, "api/Result", logger, options)
#endif
{
}