diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache
index e9e3655c5c25..c5f3c0eadfa9 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache
@@ -55,7 +55,8 @@ Install-Package CompareNETObjects
```
{{#useRestSharp}}
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
{{/useRestSharp}}
@@ -102,7 +103,10 @@ c.Proxy = webProxy;
```
{{#useHttpClient}}
-To use your own HttpClient instances just pass them to the ApiClass constructor.
+### Connections
+Each ApiClass (properly the ApiClient inside it) will create an istance of HttpClient. It will use that for the entire lifecycle and dispose it when called the Dispose method.
+
+To better manager the connections it's a common practice to reuse the HttpClient and HttpClientHander (see [here](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net) for details). To use your own HttpClient instance just pass it to the ApiClass constructor.
```csharp
HttpClientHandler yourHandler = new HttpClientHandler();
@@ -110,17 +114,20 @@ HttpClient yourHttpClient = new HttpClient(yourHandler);
var api = new YourApiClass(yourHttpClient, yourHandler);
```
-If you want to use an HttpClient and don't have access to the handler, for example in a DI context in aspnetcore when
-using IHttpClientFactory. You need to disable the features that require handler access:
+If you want to use an HttpClient and don't have access to the handler, for example in a DI context in Asp.net Core when using IHttpClientFactory.
```csharp
HttpClient yourHttpClient = new HttpClient();
-var api = new YourApiClass(yourHttpClient, null, true);
+var api = new YourApiClass(yourHttpClient);
```
+You'll loose some configuration settings, the features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. You need to either manually handle those in your setup of the HttpClient or they won't be available.
-The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
-You need to either manually handle those in your setup of the HttpClient or they won't be available.
+Here an example of DI setup in a sample web project:
+```csharp
+services.AddHttpClient(httpClient =>
+ new PetApi(httpClient));
+```
{{/useHttpClient}}
diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache
index 23ba41d1a0f8..bdc24c21a172 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache
@@ -161,16 +161,16 @@ namespace {{packageName}}.Client
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios),
/// encapsulating general REST accessor use cases.
///
+ ///
+ /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor.
+ ///
{{>visibility}} partial class ApiClient : IDisposable, ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}}
{
private readonly String _baseUrl;
- private readonly HttpClientHandler _httpClientHandler;
- private readonly bool _disposeHandler;
- private readonly HttpClient _httpClient;
- private readonly bool _disposeClient;
-
- private readonly bool _disableHandlerFeatures;
+ private readonly HttpClientHandler _httpClientHandler;
+ private readonly HttpClient _httpClient;
+ private readonly bool _disposeClient;
///
/// Specifies the settings on a object.
@@ -192,37 +192,88 @@ namespace {{packageName}}.Client
///
/// Initializes a new instance of the , defaulting to the global configurations' base url.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
- public ApiClient(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) :
- this({{packageName}}.Client.GlobalConfiguration.Instance.BasePath, client, handler, disableHandlerFeatures)
- {
+ public ApiClient() :
+ this({{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
+ {
}
-
+
///
- /// Initializes a new instance of the
+ /// Initializes a new instance of the .
///
/// The target service's base path in URL format.
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public ApiClient(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
- {
- if (string.IsNullOrEmpty(basePath))
- throw new ArgumentException("basePath cannot be empty");
+ public ApiClient(String basePath)
+ {
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
- _baseUrl = basePath;
- if((client != null && handler == null) && !disableHandlerFeatures) {
- throw new ArgumentException("If providing HttpClient, you also need to provide its handler or disable features requiring the handler, see README.md");
- }
-
- _disableHandlerFeatures = disableHandlerFeatures;
- _httpClientHandler = handler ?? new HttpClientHandler();
- _disposeHandler = handler == null;
- _httpClient = client ?? new HttpClient(_httpClientHandler, false);
- _disposeClient = client == null;
+ _httpClientHandler = new HttpClientHandler();
+ _httpClient = new HttpClient(_httpClientHandler, true);
+ _disposeClient = true;
+ _baseUrl = basePath;
+ }
+
+ ///
+ /// Initializes a new instance of the , defaulting to the global configurations' base url.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public ApiClient(HttpClient client) :
+ this(client, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public ApiClient(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client cannot be null");
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
+
+ _httpClient = client;
+ _baseUrl = basePath;
+ }
+
+ ///
+ /// Initializes a new instance of the , defaulting to the global configurations' base url.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ public ApiClient(HttpClient client, HttpClientHandler handler) :
+ this(client, handler, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the .
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ public ApiClient(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client cannot be null");
+ if (handler == null) throw new ArgumentNullException("handler cannot be null");
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
+
+ _httpClientHandler = handler;
+ _httpClient = client;
+ _baseUrl = basePath;
}
///
@@ -233,9 +284,6 @@ namespace {{packageName}}.Client
if(_disposeClient) {
_httpClient.Dispose();
}
- if(_disposeHandler) {
- _httpClientHandler.Dispose();
- }
}
/// Prepares multipart/form-data content
@@ -373,10 +421,10 @@ namespace {{packageName}}.Client
return request;
}
- partial void InterceptRequest(HttpRequestMessage req, HttpClientHandler handler);
+ partial void InterceptRequest(HttpRequestMessage req);
partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response);
- private ApiResponse ToApiResponse(HttpResponseMessage response, object responseData, HttpClientHandler handler, Uri uri)
+ private ApiResponse ToApiResponse(HttpResponseMessage response, object responseData, Uri uri)
{
T result = (T) responseData;
string rawContent = response.Content.ToString();
@@ -405,18 +453,15 @@ namespace {{packageName}}.Client
}
}
- if(!_disableHandlerFeatures)
+ if (_httpClientHandler != null && response != null)
{
- if (response != null)
- {
- try {
- foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
- {
- transformed.Cookies.Add(cookie);
- }
+ try {
+ foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri))
+ {
+ transformed.Cookies.Add(cookie);
}
- catch (PlatformNotSupportedException) {}
}
+ catch (PlatformNotSupportedException) {}
}
return transformed;
@@ -431,8 +476,6 @@ namespace {{packageName}}.Client
IReadableConfiguration configuration,
System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- var handler = _httpClientHandler;
- var client = _httpClient;
var deserializer = new CustomJsonCodec(SerializerSettings, configuration);
var finalToken = cancellationToken;
@@ -442,29 +485,31 @@ namespace {{packageName}}.Client
var tokenSource = new CancellationTokenSource(configuration.Timeout);
finalToken = CancellationTokenSource.CreateLinkedTokenSource(finalToken, tokenSource.Token).Token;
}
- if(!_disableHandlerFeatures) {
- if (configuration.Proxy != null)
- {
- handler.Proxy = configuration.Proxy;
- }
- if (configuration.ClientCertificates != null)
- {
- handler.ClientCertificates.AddRange(configuration.ClientCertificates);
- }
+ if (configuration.Proxy != null)
+ {
+ if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
+ _httpClientHandler.Proxy = configuration.Proxy;
+ }
+
+ if (configuration.ClientCertificates != null)
+ {
+ if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
+ _httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null;
if (cookieContainer != null)
{
+ if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
foreach (var cookie in cookieContainer)
{
- handler.CookieContainer.Add(cookie);
+ _httpClientHandler.CookieContainer.Add(cookie);
}
}
- InterceptRequest(req, handler);
+ InterceptRequest(req);
HttpResponseMessage response;
{{#supportsRetry}}
@@ -472,7 +517,7 @@ namespace {{packageName}}.Client
{
var policy = RetryConfiguration.AsyncRetryPolicy;
var policyResult = await policy
- .ExecuteAndCaptureAsync(() => client.SendAsync(req, cancellationToken))
+ .ExecuteAndCaptureAsync(() => _httpClient.SendAsync(req, cancellationToken))
.ConfigureAwait(false);
response = (policyResult.Outcome == OutcomeType.Successful) ?
policyResult.Result : new HttpResponseMessage()
@@ -484,7 +529,7 @@ namespace {{packageName}}.Client
else
{
{{/supportsRetry}}
- response = await client.SendAsync(req, cancellationToken).ConfigureAwait(false);
+ response = await _httpClient.SendAsync(req, cancellationToken).ConfigureAwait(false);
{{#supportsRetry}}
}
{{/supportsRetry}}
@@ -503,7 +548,7 @@ namespace {{packageName}}.Client
InterceptResponse(req, response);
- var result = ToApiResponse(response, responseData, handler, req.RequestUri);
+ var result = ToApiResponse(response, responseData, req.RequestUri);
return result;
}
diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache
index 4bb08fb68209..b71ebee0f81e 100644
--- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/api.mustache
@@ -107,29 +107,24 @@ namespace {{packageName}}.{{apiPackage}}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public {{classname}}(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public {{classname}}() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public {{classname}}(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public {{classname}}(String basePath)
{
this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
{{packageName}}.Client.GlobalConfiguration.Instance,
new {{packageName}}.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
@@ -138,15 +133,12 @@ namespace {{packageName}}.{{apiPackage}}
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public {{classname}}({{packageName}}.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public {{classname}}({{packageName}}.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -154,7 +146,140 @@ namespace {{packageName}}.{{apiPackage}}
{{packageName}}.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new {{packageName}}.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ {{#supportsAsync}}
+ this.AsynchronousClient = this.ApiClient;
+ {{/supportsAsync}}
+ ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public {{classname}}(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public {{classname}}(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
+ {{packageName}}.Client.GlobalConfiguration.Instance,
+ new {{packageName}}.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new {{packageName}}.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ {{#supportsAsync}}
+ this.AsynchronousClient = this.ApiClient;
+ {{/supportsAsync}}
+ this.ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public {{classname}}(HttpClient client, {{packageName}}.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
+ {{packageName}}.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new {{packageName}}.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ {{#supportsAsync}}
+ this.AsynchronousClient = this.ApiClient;
+ {{/supportsAsync}}
+ ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public {{classname}}(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public {{classname}}(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
+ {{packageName}}.Client.GlobalConfiguration.Instance,
+ new {{packageName}}.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new {{packageName}}.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ {{#supportsAsync}}
+ this.AsynchronousClient = this.ApiClient;
+ {{/supportsAsync}}
+ this.ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public {{classname}}(HttpClient client, HttpClientHandler handler, {{packageName}}.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
+ {{packageName}}.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new {{packageName}}.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
@@ -169,6 +294,7 @@ namespace {{packageName}}.{{apiPackage}}
/// The client interface for synchronous API access.{{#supportsAsync}}
/// The client interface for asynchronous API access.{{/supportsAsync}}
/// The configuration object.
+ ///
public {{classname}}({{packageName}}.Client.ISynchronousClient client, {{#supportsAsync}}{{packageName}}.Client.IAsynchronousClient asyncClient, {{/supportsAsync}}{{packageName}}.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md
index ff1567b9aa52..e16da183ea85 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md
@@ -50,7 +50,10 @@ webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
```
-To use your own HttpClient instances just pass them to the ApiClass constructor.
+### Connections
+Each ApiClass (properly the ApiClient inside it) will create an istance of HttpClient. It will use that for the entire lifecycle and dispose it when called the Dispose method.
+
+To better manager the connections it's a common practice to reuse the HttpClient and HttpClientHander (see [here](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net) for details). To use your own HttpClient instance just pass it to the ApiClass constructor.
```csharp
HttpClientHandler yourHandler = new HttpClientHandler();
@@ -58,17 +61,20 @@ HttpClient yourHttpClient = new HttpClient(yourHandler);
var api = new YourApiClass(yourHttpClient, yourHandler);
```
-If you want to use an HttpClient and don't have access to the handler, for example in a DI context in aspnetcore when
-using IHttpClientFactory. You need to disable the features that require handler access:
+If you want to use an HttpClient and don't have access to the handler, for example in a DI context in Asp.net Core when using IHttpClientFactory.
```csharp
HttpClient yourHttpClient = new HttpClient();
-var api = new YourApiClass(yourHttpClient, null, true);
+var api = new YourApiClass(yourHttpClient);
```
+You'll loose some configuration settings, the features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. You need to either manually handle those in your setup of the HttpClient or they won't be available.
-The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
-You need to either manually handle those in your setup of the HttpClient or they won't be available.
+Here an example of DI setup in a sample web project:
+```csharp
+services.AddHttpClient(httpClient =>
+ new PetApi(httpClient));
+```
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs
index 58e3683c24e5..6ee69d73cd39 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/AnotherFakeApi.cs
@@ -101,44 +101,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public AnotherFakeApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public AnotherFakeApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public AnotherFakeApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public AnotherFakeApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -146,7 +138,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public AnotherFakeApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public AnotherFakeApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public AnotherFakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public AnotherFakeApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public AnotherFakeApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public AnotherFakeApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -159,6 +276,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs
index c9d39aec22a6..f79f629815a8 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -94,44 +94,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public DefaultApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public DefaultApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public DefaultApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public DefaultApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public DefaultApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public DefaultApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -139,7 +131,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public DefaultApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public DefaultApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public DefaultApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public DefaultApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public DefaultApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public DefaultApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -152,6 +269,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs
index 22fd5bf56e6c..96d3df634d2f 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs
@@ -818,44 +818,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public FakeApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public FakeApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public FakeApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public FakeApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public FakeApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public FakeApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -863,7 +855,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public FakeApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public FakeApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public FakeApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -876,6 +993,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs
index 413e4dc0886b..1aa57d4b4e26 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs
@@ -101,44 +101,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public FakeClassnameTags123Api(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public FakeClassnameTags123Api() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public FakeClassnameTags123Api(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public FakeClassnameTags123Api(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -146,7 +138,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeClassnameTags123Api(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeClassnameTags123Api(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public FakeClassnameTags123Api(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public FakeClassnameTags123Api(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public FakeClassnameTags123Api(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public FakeClassnameTags123Api(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -159,6 +276,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs
index 2857ea58fefb..ab82da44ef0f 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs
@@ -463,44 +463,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public PetApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public PetApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public PetApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public PetApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public PetApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public PetApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -508,7 +500,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public PetApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public PetApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public PetApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public PetApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public PetApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public PetApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -521,6 +638,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs
index b2ac30bcb545..760576e1ec06 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/StoreApi.cs
@@ -226,44 +226,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public StoreApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public StoreApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public StoreApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public StoreApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public StoreApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public StoreApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -271,7 +263,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public StoreApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public StoreApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public StoreApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public StoreApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public StoreApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public StoreApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -284,6 +401,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs
index 3a6c2619d018..c1174daeadfb 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/UserApi.cs
@@ -398,44 +398,36 @@ namespace Org.OpenAPITools.Api
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public UserApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
+ public UserApi() : this((string)null)
{
-
}
///
/// Initializes a new instance of the class.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// The target service's base path in URL format.
+ ///
///
- public UserApi(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public UserApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
///
- /// Initializes a new instance of the class
- /// using Configuration object
+ /// Initializes a new instance of the class using Configuration object.
///
- /// An instance of Configuration
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
+ /// An instance of Configuration.
+ ///
///
- public UserApi(Org.OpenAPITools.Client.Configuration configuration, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
+ public UserApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@@ -443,7 +435,132 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
configuration
);
- this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath, client, handler, disableHandlerFeatures);
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public UserApi(HttpClient client) : this(client, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public UserApi(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public UserApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ ///
+ public UserApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ public UserApi(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
+ this.Client = this.ApiClient;
+ this.AsynchronousClient = this.ApiClient;
+ this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
+ }
+
+ ///
+ /// Initializes a new instance of the class using Configuration object.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// An instance of Configuration.
+ ///
+ ///
+ public UserApi(HttpClient client, HttpClientHandler handler, Org.OpenAPITools.Client.Configuration configuration)
+ {
+ if (configuration == null) throw new ArgumentNullException("configuration");
+ if (client == null) throw new ArgumentNullException("client");
+ if (handler == null) throw new ArgumentNullException("handler");
+
+ this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
+ Org.OpenAPITools.Client.GlobalConfiguration.Instance,
+ configuration
+ );
+ this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, handler, this.Configuration.BasePath);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -456,6 +573,7 @@ namespace Org.OpenAPITools.Api
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
+ ///
public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiClient.cs
index 12c007bdb9f6..6cf20d594436 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiClient.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ApiClient.cs
@@ -161,16 +161,16 @@ namespace Org.OpenAPITools.Client
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios),
/// encapsulating general REST accessor use cases.
///
+ ///
+ /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor.
+ ///
public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient
{
private readonly String _baseUrl;
- private readonly HttpClientHandler _httpClientHandler;
- private readonly bool _disposeHandler;
- private readonly HttpClient _httpClient;
- private readonly bool _disposeClient;
-
- private readonly bool _disableHandlerFeatures;
+ private readonly HttpClientHandler _httpClientHandler;
+ private readonly HttpClient _httpClient;
+ private readonly bool _disposeClient;
///
/// Specifies the settings on a object.
@@ -192,37 +192,88 @@ namespace Org.OpenAPITools.Client
///
/// Initializes a new instance of the , defaulting to the global configurations' base url.
///
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
- public ApiClient(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) :
- this(Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath, client, handler, disableHandlerFeatures)
- {
+ public ApiClient() :
+ this(Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
+ {
}
-
+
///
- /// Initializes a new instance of the
+ /// Initializes a new instance of the .
///
/// The target service's base path in URL format.
- /// An instance of HttpClient
- /// An instance of HttpClientHandler that is used by HttpClient
- /// Disable ApiClient features that require access to the HttpClientHandler
///
- public ApiClient(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
- {
- if (string.IsNullOrEmpty(basePath))
- throw new ArgumentException("basePath cannot be empty");
+ public ApiClient(String basePath)
+ {
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
- _baseUrl = basePath;
- if((client != null && handler == null) && !disableHandlerFeatures) {
- throw new ArgumentException("If providing HttpClient, you also need to provide its handler or disable features requiring the handler, see README.md");
- }
-
- _disableHandlerFeatures = disableHandlerFeatures;
- _httpClientHandler = handler ?? new HttpClientHandler();
- _disposeHandler = handler == null;
- _httpClient = client ?? new HttpClient(_httpClientHandler, false);
- _disposeClient = client == null;
+ _httpClientHandler = new HttpClientHandler();
+ _httpClient = new HttpClient(_httpClientHandler, true);
+ _disposeClient = true;
+ _baseUrl = basePath;
+ }
+
+ ///
+ /// Initializes a new instance of the , defaulting to the global configurations' base url.
+ ///
+ /// An instance of HttpClient.
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public ApiClient(HttpClient client) :
+ this(client, Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the
+ ///
+ /// An instance of HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ ///
+ /// Some configuration settings will not be applied without passing an HttpClientHandler.
+ /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
+ ///
+ public ApiClient(HttpClient client, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client cannot be null");
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
+
+ _httpClient = client;
+ _baseUrl = basePath;
+ }
+
+ ///
+ /// Initializes a new instance of the , defaulting to the global configurations' base url.
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ ///
+ public ApiClient(HttpClient client, HttpClientHandler handler) :
+ this(client, handler, Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the .
+ ///
+ /// An instance of HttpClient.
+ /// An instance of HttpClientHandler that is used by HttpClient.
+ /// The target service's base path in URL format.
+ ///
+ ///
+ public ApiClient(HttpClient client, HttpClientHandler handler, String basePath)
+ {
+ if (client == null) throw new ArgumentNullException("client cannot be null");
+ if (handler == null) throw new ArgumentNullException("handler cannot be null");
+ if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
+
+ _httpClientHandler = handler;
+ _httpClient = client;
+ _baseUrl = basePath;
}
///
@@ -233,9 +284,6 @@ namespace Org.OpenAPITools.Client
if(_disposeClient) {
_httpClient.Dispose();
}
- if(_disposeHandler) {
- _httpClientHandler.Dispose();
- }
}
/// Prepares multipart/form-data content
@@ -371,10 +419,10 @@ namespace Org.OpenAPITools.Client
return request;
}
- partial void InterceptRequest(HttpRequestMessage req, HttpClientHandler handler);
+ partial void InterceptRequest(HttpRequestMessage req);
partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response);
- private ApiResponse ToApiResponse(HttpResponseMessage response, object responseData, HttpClientHandler handler, Uri uri)
+ private ApiResponse ToApiResponse(HttpResponseMessage response, object responseData, Uri uri)
{
T result = (T) responseData;
string rawContent = response.Content.ToString();
@@ -403,18 +451,15 @@ namespace Org.OpenAPITools.Client
}
}
- if(!_disableHandlerFeatures)
+ if (_httpClientHandler != null && response != null)
{
- if (response != null)
- {
- try {
- foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
- {
- transformed.Cookies.Add(cookie);
- }
+ try {
+ foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri))
+ {
+ transformed.Cookies.Add(cookie);
}
- catch (PlatformNotSupportedException) {}
}
+ catch (PlatformNotSupportedException) {}
}
return transformed;
@@ -429,8 +474,6 @@ namespace Org.OpenAPITools.Client
IReadableConfiguration configuration,
System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
- var handler = _httpClientHandler;
- var client = _httpClient;
var deserializer = new CustomJsonCodec(SerializerSettings, configuration);
var finalToken = cancellationToken;
@@ -440,36 +483,38 @@ namespace Org.OpenAPITools.Client
var tokenSource = new CancellationTokenSource(configuration.Timeout);
finalToken = CancellationTokenSource.CreateLinkedTokenSource(finalToken, tokenSource.Token).Token;
}
- if(!_disableHandlerFeatures) {
- if (configuration.Proxy != null)
- {
- handler.Proxy = configuration.Proxy;
- }
- if (configuration.ClientCertificates != null)
- {
- handler.ClientCertificates.AddRange(configuration.ClientCertificates);
- }
+ if (configuration.Proxy != null)
+ {
+ if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
+ _httpClientHandler.Proxy = configuration.Proxy;
+ }
+
+ if (configuration.ClientCertificates != null)
+ {
+ if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
+ _httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null;
if (cookieContainer != null)
{
+ if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
foreach (var cookie in cookieContainer)
{
- handler.CookieContainer.Add(cookie);
+ _httpClientHandler.CookieContainer.Add(cookie);
}
}
- InterceptRequest(req, handler);
+ InterceptRequest(req);
HttpResponseMessage response;
if (RetryConfiguration.AsyncRetryPolicy != null)
{
var policy = RetryConfiguration.AsyncRetryPolicy;
var policyResult = await policy
- .ExecuteAndCaptureAsync(() => client.SendAsync(req, cancellationToken))
+ .ExecuteAndCaptureAsync(() => _httpClient.SendAsync(req, cancellationToken))
.ConfigureAwait(false);
response = (policyResult.Outcome == OutcomeType.Successful) ?
policyResult.Result : new HttpResponseMessage()
@@ -480,7 +525,7 @@ namespace Org.OpenAPITools.Client
}
else
{
- response = await client.SendAsync(req, cancellationToken).ConfigureAwait(false);
+ response = await _httpClient.SendAsync(req, cancellationToken).ConfigureAwait(false);
}
object responseData = deserializer.Deserialize(response);
@@ -497,7 +542,7 @@ namespace Org.OpenAPITools.Client
InterceptResponse(req, response);
- var result = ToApiResponse(response, responseData, handler, req.RequestUri);
+ var result = ToApiResponse(response, responseData, req.RequestUri);
return result;
}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md
index 8d4de67b2fb9..d4c69a744264 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md
@@ -29,7 +29,8 @@ Install-Package System.ComponentModel.Annotations
Install-Package CompareNETObjects
```
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
## Installation
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md
index 8d4de67b2fb9..d4c69a744264 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md
@@ -29,7 +29,8 @@ Install-Package System.ComponentModel.Annotations
Install-Package CompareNETObjects
```
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
## Installation
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
index cec8c29dbba8..325ba2bd65b2 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
@@ -32,7 +32,8 @@ Install-Package System.ComponentModel.Annotations
Install-Package CompareNETObjects
```
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
## Installation
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
index 8d4de67b2fb9..d4c69a744264 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
@@ -29,7 +29,8 @@ Install-Package System.ComponentModel.Annotations
Install-Package CompareNETObjects
```
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
+NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
## Installation