[csharp][netcore-httpclient] Refactor of constructors (#9145)

* Refactor on constructors

Updated samples

Fixed a bug of previous commit

Refactor on constructors

* Fixed indentation in source code

* Updated samples

* Marked constructors with obsolete

* Updated obsolete constructors messages

* Updated samples
This commit is contained in:
Luca Mazzanti 2021-04-16 16:03:07 +02:00 committed by GitHub
parent 515d4a0153
commit 3929afff7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 214 additions and 692 deletions

View File

@ -168,9 +168,9 @@ namespace {{packageName}}.Client
{
private readonly String _baseUrl;
private readonly HttpClientHandler _httpClientHandler;
private readonly HttpClient _httpClient;
private readonly bool _disposeClient;
private readonly HttpClientHandler _httpClientHandler;
private readonly HttpClient _httpClient;
private readonly bool _disposeClient;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
@ -192,88 +192,63 @@ namespace {{packageName}}.Client
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public ApiClient() :
this({{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
{
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public ApiClient(String basePath)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_disposeClient = true;
_baseUrl = basePath;
_baseUrl = basePath;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public ApiClient(HttpClient client) :
this(client, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
{
/// </remarks>
public ApiClient(HttpClient client, HttpClientHandler handler = null) :
this(client, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath, handler)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
public ApiClient(HttpClient client, HttpClientHandler handler) :
this(client, handler, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
{
}
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
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;
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public ApiClient(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client cannot be null");
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = handler;
_httpClient = client;
_baseUrl = basePath;
}
/// <summary>

View File

@ -108,6 +108,7 @@ namespace {{packageName}}.{{apiPackage}}
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public {{classname}}() : this((string)null)
{
}
@ -116,8 +117,9 @@ namespace {{packageName}}.{{apiPackage}}
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public {{classname}}(String basePath)
{
this.Configuration = {{packageName}}.Client.Configuration.MergeConfigurations(
@ -138,6 +140,7 @@ namespace {{packageName}}.{{apiPackage}}
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public {{classname}}({{packageName}}.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -158,13 +161,14 @@ namespace {{packageName}}.{{apiPackage}}
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public {{classname}}(HttpClient client) : this(client, (string)null)
public {{classname}}(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -173,14 +177,15 @@ namespace {{packageName}}.{{apiPackage}}
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public {{classname}}(HttpClient client, String basePath)
public {{classname}}(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -188,7 +193,7 @@ namespace {{packageName}}.{{apiPackage}}
{{packageName}}.Client.GlobalConfiguration.Instance,
new {{packageName}}.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new {{packageName}}.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new {{packageName}}.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
@ -201,85 +206,23 @@ namespace {{packageName}}.{{apiPackage}}
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public {{classname}}(HttpClient client, {{packageName}}.Client.Configuration configuration)
public {{classname}}(HttpClient client, {{packageName}}.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public {{classname}}(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new {{packageName}}.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;

View File

@ -102,6 +102,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public AnotherFakeApi() : this((string)null)
{
}
@ -110,8 +111,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public AnotherFakeApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -130,6 +132,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -148,13 +151,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public AnotherFakeApi(HttpClient client) : this(client, (string)null)
public AnotherFakeApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -163,14 +167,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public AnotherFakeApi(HttpClient client, String basePath)
public AnotherFakeApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -178,7 +183,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -189,81 +194,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public AnotherFakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public AnotherFakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public AnotherFakeApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -95,6 +95,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public DefaultApi() : this((string)null)
{
}
@ -103,8 +104,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public DefaultApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -123,6 +125,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public DefaultApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -141,13 +144,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public DefaultApi(HttpClient client) : this(client, (string)null)
public DefaultApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -156,14 +160,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public DefaultApi(HttpClient client, String basePath)
public DefaultApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -171,7 +176,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -182,81 +187,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public DefaultApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public DefaultApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public DefaultApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -819,6 +819,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeApi() : this((string)null)
{
}
@ -827,8 +828,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -847,6 +849,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -865,13 +868,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeApi(HttpClient client) : this(client, (string)null)
public FakeApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -880,14 +884,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeApi(HttpClient client, String basePath)
public FakeApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -895,7 +900,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -906,81 +911,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public FakeApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public FakeApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -102,6 +102,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeClassnameTags123Api() : this((string)null)
{
}
@ -110,8 +111,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeClassnameTags123Api(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -130,6 +132,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -148,13 +151,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeClassnameTags123Api(HttpClient client) : this(client, (string)null)
public FakeClassnameTags123Api(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -163,14 +167,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeClassnameTags123Api(HttpClient client, String basePath)
public FakeClassnameTags123Api(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -178,7 +183,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -189,81 +194,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public FakeClassnameTags123Api(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public FakeClassnameTags123Api(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public FakeClassnameTags123Api(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -464,6 +464,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public PetApi() : this((string)null)
{
}
@ -472,8 +473,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public PetApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -492,6 +494,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public PetApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -510,13 +513,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public PetApi(HttpClient client) : this(client, (string)null)
public PetApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -525,14 +529,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public PetApi(HttpClient client, String basePath)
public PetApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -540,7 +545,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -551,81 +556,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public PetApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public PetApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public PetApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -227,6 +227,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public StoreApi() : this((string)null)
{
}
@ -235,8 +236,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public StoreApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -255,6 +257,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public StoreApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -273,13 +276,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public StoreApi(HttpClient client) : this(client, (string)null)
public StoreApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -288,14 +292,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public StoreApi(HttpClient client, String basePath)
public StoreApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -303,7 +308,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -314,81 +319,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public StoreApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public StoreApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public StoreApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -399,6 +399,7 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public UserApi() : this((string)null)
{
}
@ -407,8 +408,9 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public UserApi(String basePath)
{
this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations(
@ -427,6 +429,7 @@ namespace Org.OpenAPITools.Api
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public UserApi(Org.OpenAPITools.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
@ -445,13 +448,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public UserApi(HttpClient client) : this(client, (string)null)
public UserApi(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler)
{
}
@ -460,14 +464,15 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public UserApi(HttpClient client, String basePath)
public UserApi(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client");
@ -475,7 +480,7 @@ namespace Org.OpenAPITools.Api
Org.OpenAPITools.Client.GlobalConfiguration.Instance,
new Org.OpenAPITools.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath);
this.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@ -486,81 +491,23 @@ namespace Org.OpenAPITools.Api
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public UserApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration)
public UserApi(HttpClient client, Org.OpenAPITools.Client.Configuration configuration, HttpClientHandler handler = null)
{
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public UserApi(HttpClient client, HttpClientHandler handler) : this(client, handler, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class using Configuration object.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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.ApiClient = new Org.OpenAPITools.Client.ApiClient(client, this.Configuration.BasePath, handler);
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;

View File

@ -168,9 +168,9 @@ namespace Org.OpenAPITools.Client
{
private readonly String _baseUrl;
private readonly HttpClientHandler _httpClientHandler;
private readonly HttpClient _httpClient;
private readonly bool _disposeClient;
private readonly HttpClientHandler _httpClientHandler;
private readonly HttpClient _httpClient;
private readonly bool _disposeClient;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
@ -192,88 +192,63 @@ namespace Org.OpenAPITools.Client
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public ApiClient() :
this(Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
{
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />.
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
[Obsolete("Constructors without HttpClient have non-trivial drawbacks and are thus considered deprecated. Check README.md for details.")]
public ApiClient(String basePath)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_disposeClient = true;
_baseUrl = basePath;
_baseUrl = basePath;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public ApiClient(HttpClient client) :
this(client, Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
{
/// </remarks>
public ApiClient(HttpClient client, HttpClientHandler handler = null) :
this(client, Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath, handler)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
public ApiClient(HttpClient client, HttpClientHandler handler) :
this(client, handler, Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath)
{
}
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient.</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
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;
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="handler">An optional instance of HttpClientHandler that is used by HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <remarks>
/// Some configuration settings will not be applied without passing an HttpClientHandler.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public ApiClient(HttpClient client, String basePath, HttpClientHandler handler = null)
{
if (client == null) throw new ArgumentNullException("client cannot be null");
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = handler;
_httpClient = client;
_baseUrl = basePath;
}
/// <summary>