Merge remote-tracking branch 'origin/master' into 5.2.x

This commit is contained in:
William Cheng
2021-04-01 09:25:19 +08:00
184 changed files with 5533 additions and 3954 deletions

View File

@@ -23,7 +23,6 @@ function installDart {
sudo apt-get update
sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin"
export DART_POST_PROCESS="dart format"
}
if [ "$NODE_INDEX" = "1" ]; then

View File

@@ -2,6 +2,5 @@ generatorName: dart-dio-next
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
enablePostProcessFile: "true"
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,7 +1,7 @@
---
# csharp-netcore test files and image for upload
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: ec34838fbbb1abb9f762949d510503b6237b607400a85c848c234c39d013a776
sha256: 95e40cace36e7cd1608fa494161f06291f4cfb8f859ec4196ae9939f520b152a
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"

View File

@@ -22,7 +22,6 @@ The following environment variables are supported by their respective generators
* `CPP_POST_PROCESS_FILE`
* `CSHARP_POST_PROCESS_FILE`
* `C_POST_PROCESS_FILE`
* `DART_POST_PROCESS`
* `DART_POST_PROCESS_FILE`
* `FSHARP_POST_PROCESS_FILE`
* `GO_POST_PROCESS_FILE`

View File

@@ -576,7 +576,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
var.isString = false;
var.isLong = false;
var.isInteger = false;
} else if ("int32".equals(var.dataFormat)) {
} else if ("int".equals(var.dataType) || "int32".equals(var.dataFormat)) {
var.isInteger = true;
var.isString = false;
var.isLong = false;

View File

@@ -692,33 +692,4 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
}
}
}
@Override
public void postProcess() {
if (isEnablePostProcessFile()) {
// Using the condition here to have way to still disable this
// for older Dart generators in CI by default.
// Post processing the whole dart output is much faster then individual files.
// Setting this variable to "dart format" is the suggested way of doing this.
final String dartPostProcess = System.getenv("DART_POST_PROCESS");
if (!StringUtils.isEmpty(dartPostProcess)) {
final String command = dartPostProcess + " " + getOutputDir();
try {
Process p = Runtime.getRuntime().exec(command);
int exitValue = p.waitFor();
if (exitValue != 0) {
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} else {
LOGGER.info("Successfully executed: {}", command);
}
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}
super.postProcess();
}
}

View File

@@ -36,6 +36,8 @@ import org.openapitools.codegen.meta.Stability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.curiousoddman.rgxgen.RgxGen;
import com.github.curiousoddman.rgxgen.config.RgxGenOption;
import com.github.curiousoddman.rgxgen.config.RgxGenProperties;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
@@ -994,6 +996,13 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
return "\"" + in + "\"";
}
@Override
public String toExampleValue(Schema schema) {
Object objExample = getObjectExample(schema);
String modelName = getModelName(schema);
return toExampleValueRecursive(modelName, schema, objExample, 1, "", 0, Sets.newHashSet());
}
public String toExampleValue(Schema schema, Object objExample) {
String modelName = getModelName(schema);
return toExampleValueRecursive(modelName, schema, objExample, 1, "", 0, Sets.newHashSet());
@@ -1074,7 +1083,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
// checks if the current schema has already been passed in. If so, breaks the current recursive pass
if (seenSchemas.contains(schema)) {
if (modelName != null) {
return fullPrefix + modelName + closeChars;
return fullPrefix + closeChars;
} else {
// this is a recursive schema
// need to add a reasonable example to avoid
@@ -1150,18 +1159,39 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
return fullPrefix + example + closeChars;
} else if (StringUtils.isNotBlank(schema.getPattern())) {
String pattern = schema.getPattern();
RgxGen rgxGen = new RgxGen(pattern);
/*
RxGen does not support our ECMA dialect https://github.com/curious-odd-man/RgxGen/issues/56
So strip off the leading / and trailing / and turn on ignore case if we have it
*/
Pattern valueExtractor = Pattern.compile("^/?(.+?)/?(.?)$");
Matcher m = valueExtractor.matcher(pattern);
RgxGen rgxGen = null;
if (m.find()) {
int groupCount = m.groupCount();
if (groupCount == 1) {
// only pattern found
String isolatedPattern = m.group(1);
rgxGen = new RgxGen(isolatedPattern);
} else if (groupCount == 2) {
// patterns and flag found
String isolatedPattern = m.group(1);
String flags = m.group(2);
if (flags.contains("i")) {
rgxGen = new RgxGen(isolatedPattern);
RgxGenProperties properties = new RgxGenProperties();
RgxGenOption.CASE_INSENSITIVE.setInProperties(properties, true);
rgxGen.setProperties(properties);
} else {
rgxGen = new RgxGen(isolatedPattern);
}
}
} else {
rgxGen = new RgxGen(pattern);
}
// this seed makes it so if we have [a-z] we pick a
Random random = new Random(18);
String sample = rgxGen.generate(random);
// omit leading / and trailing /, omit trailing /i
Pattern valueExtractor = Pattern.compile("^/?(.+?)/?.?$");
Matcher m = valueExtractor.matcher(sample);
if (m.find()) {
example = m.group(m.groupCount());
} else {
example = "";
}
example = rgxGen.generate(random);
} else if (schema.getMinLength() != null) {
example = "";
int len = schema.getMinLength().intValue();
@@ -1199,8 +1229,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
// If the example is already a list, return it directly instead of wrongly wrap it in another list
return fullPrefix + objExample.toString() + closeChars;
}
seenSchemas.add(schema);
example = fullPrefix + "[" + "\n" + toExampleValueRecursive(itemModelName, itemSchema, objExample, indentationLevel + 1, "", exampleLine + 1, seenSchemas) + ",\n" + closingIndentation + "]" + closeChars;
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
newSeenSchemas.add(schema);
example = fullPrefix + "[" + "\n" + toExampleValueRecursive(itemModelName, itemSchema, objExample, indentationLevel + 1, "", exampleLine + 1, newSeenSchemas) + ",\n" + closingIndentation + "]" + closeChars;
return example;
} else if (ModelUtils.isMapSchema(schema)) {
if (modelName == null) {
@@ -1222,8 +1253,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
addPropPrefix = ensureQuotes(key) + ": ";
}
String addPropsModelName = getModelName(addPropsSchema);
seenSchemas.add(schema);
example = fullPrefix + "\n" + toExampleValueRecursive(addPropsModelName, addPropsSchema, addPropsExample, indentationLevel + 1, addPropPrefix, exampleLine + 1, seenSchemas) + ",\n" + closingIndentation + closeChars;
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
newSeenSchemas.add(schema);
example = fullPrefix + "\n" + toExampleValueRecursive(addPropsModelName, addPropsSchema, addPropsExample, indentationLevel + 1, addPropPrefix, exampleLine + 1, newSeenSchemas) + ",\n" + closingIndentation + closeChars;
} else {
example = fullPrefix + closeChars;
}
@@ -1246,11 +1278,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
return fullPrefix + closeChars;
}
}
// Adds schema to seenSchemas before running example model function. romoves schema after running
// the function. It also doesnt keep track of any schemas within the ObjectModel.
seenSchemas.add(schema);
String exampleForObjectModel = exampleForObjectModel(schema, fullPrefix, closeChars, null, indentationLevel, exampleLine, closingIndentation, seenSchemas);
seenSchemas.remove(schema);
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
newSeenSchemas.add(schema);
String exampleForObjectModel = exampleForObjectModel(schema, fullPrefix, closeChars, null, indentationLevel, exampleLine, closingIndentation, newSeenSchemas);
return exampleForObjectModel;
} else if (ModelUtils.isComposedSchema(schema)) {
// TODO add examples for composed schema models without discriminators
@@ -1267,9 +1297,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
cp.setExample(discPropNameValue);
// Adds schema to seenSchemas before running example model function. romoves schema after running
// the function. It also doesnt keep track of any schemas within the ObjectModel.
seenSchemas.add(modelSchema);
String exampleForObjectModel = exampleForObjectModel(modelSchema, fullPrefix, closeChars, cp, indentationLevel, exampleLine, closingIndentation, seenSchemas);
seenSchemas.remove(modelSchema);
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
newSeenSchemas.add(schema);
String exampleForObjectModel = exampleForObjectModel(modelSchema, fullPrefix, closeChars, cp, indentationLevel, exampleLine, closingIndentation, newSeenSchemas);
return exampleForObjectModel;
} else {
return fullPrefix + closeChars;

View File

@@ -17,6 +17,7 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
@@ -431,5 +432,4 @@ public class PythonLegacyClientCodegen extends AbstractPythonCodegen implements
public String generatePackageName(String packageName) {
return underscore(packageName.replaceAll("[^\\w]+", ""));
}
}

View File

@@ -39,7 +39,6 @@ else()
find_package(cpprestsdk REQUIRED)
find_package(Boost REQUIRED)
find_package(pthreads REQUIRED)
endif()
# Manually set the cpprestsdk paths when not using package manager
@@ -68,9 +67,9 @@ target_link_directories(
)
if (UNIX)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprest pthread ${Boost_LIBRARIES} crypto)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${pthreads_LIBRARIES} ${Boost_LIBRARIES} bcrypt)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)

View File

@@ -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}}
<a name="installation"></a>
@@ -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<YourApiClass>(httpClient =>
new PetApi(httpClient));
```
{{/useHttpClient}}

View File

@@ -161,17 +161,17 @@ namespace {{packageName}}.Client
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios),
/// encapsulating general REST accessor use cases.
/// </summary>
/// <remarks>
/// The Dispose method will manage the HttpClient lifecycle when not passed by constructor.
/// </remarks>
{{>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;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
/// These settings can be adjusted to accomodate custom serialization rules.
@@ -192,37 +192,88 @@ namespace {{packageName}}.Client
/// <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>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
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)
{
}
/// <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>
public ApiClient(String basePath)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_disposeClient = true;
_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.
/// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings.
/// </remarks>
public ApiClient(HttpClient client) :
this(client, {{packageName}}.Client.GlobalConfiguration.Instance.BasePath)
{
}
/// <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>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public ApiClient(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
/// <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 (string.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
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;
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;
/// <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>
/// 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;
}
/// <summary>
@@ -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<T> ToApiResponse<T>(HttpResponseMessage response, object responseData, HttpClientHandler handler, Uri uri)
private ApiResponse<T> ToApiResponse<T>(HttpResponseMessage response, object responseData, Uri uri)
{
T result = (T) responseData;
string rawContent = response.Content.ToString();
@@ -405,19 +453,16 @@ namespace {{packageName}}.Client
}
}
if(!_disableHandlerFeatures)
{
if (response != null)
if (_httpClientHandler != null && response != null)
{
try {
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
}
}
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(_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)
{
handler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
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<Cookie> : 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<T>(response, responseData, handler, req.RequestUri);
var result = ToApiResponse<T>(response, responseData, req.RequestUri);
return result;
}

View File

@@ -107,29 +107,24 @@ namespace {{packageName}}.{{apiPackage}}
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public {{classname}}(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public {{classname}}() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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}}
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="{{classname}}"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, {{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;
}
/// <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.Client = this.ApiClient;
{{#supportsAsync}}
this.AsynchronousClient = this.ApiClient;
@@ -169,6 +294,7 @@ namespace {{packageName}}.{{apiPackage}}
/// <param name="client">The client interface for synchronous API access.</param>{{#supportsAsync}}
/// <param name="asyncClient">The client interface for asynchronous API access.</param>{{/supportsAsync}}
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public {{classname}}({{packageName}}.Client.ISynchronousClient client, {{#supportsAsync}}{{packageName}}.Client.IAsynchronousClient asyncClient, {{/supportsAsync}}{{packageName}}.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -24,6 +24,7 @@
{{/complexType}}
{{/isEnum}}
{{#isEnum}}
/// <summary>
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
/// </summary>

View File

@@ -178,7 +178,7 @@ class {{{classname}}} {
Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}} {{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} {{/hasOptionalParams}});
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
{{#returnType}}
// When a remote server returns no body with a status of 204, we shall not decode it.
@@ -187,16 +187,16 @@ class {{{classname}}} {
if (response.body != null && response.statusCode != HttpStatus.noContent) {
{{#native_serialization}}
{{#isArray}}
return (apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as List)
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}') as List)
.cast<{{{returnBaseType}}}>()
.{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}};
{{/isArray}}
{{^isArray}}
{{#isMap}}
return {{{returnType}}}.from(apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}'));
return {{{returnType}}}.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}'),);
{{/isMap}}
{{^isMap}}
return apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as {{{returnType}}};
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}',) as {{{returnType}}};
{{/isMap}}{{/isArray}}{{/native_serialization}}{{#json_serializable}}
{{#isArray}}
{{#uniqueItems}}

View File

@@ -51,17 +51,16 @@ class ApiClient {
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
/// returns an unmodifiable view of the authentications, since none should be added
/// nor deleted
Map<String, Authentication> get authentications =>
Map.unmodifiable(_authentications);
/// Returns an unmodifiable [Map] of the authentications, since none should be added
/// or deleted.
Map<String, Authentication> get authentications => Map.unmodifiable(_authentications);
T getAuthentication<T extends Authentication>(String name) {
final authentication = _authentications[name];
return authentication is T ? authentication : null;
}
// We dont use a Map<String, String> for queryParams.
// We don't use a Map<String, String> for queryParams.
// If collectionFormat is 'multi', a key might appear multiple times.
Future<Response> invokeAPI(
String path,
@@ -92,7 +91,7 @@ class ApiClient {
}
try {
// Special case for uploading a single file which isnt a 'multipart/form-data'.
// Special case for uploading a single file which isn't a 'multipart/form-data'.
if (
body is MultipartFile && (nullableContentType == null ||
!nullableContentType.toLowerCase().startsWith('multipart/form-data'))
@@ -122,7 +121,7 @@ class ApiClient {
final msgBody = nullableContentType == 'application/x-www-form-urlencoded'
? formParams
: serialize(body);
: await serializeAsync(body);
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
switch(method) {
@@ -147,9 +146,48 @@ class ApiClient {
throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',);
}
{{#native_serialization}}
Future<dynamic> deserializeAsync(String json, String targetType, {bool growable}) async =>
// ignore: deprecated_member_use_from_same_package
deserialize(json, targetType, growable: growable);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
dynamic deserialize(String json, String targetType, {bool growable}) {
// Remove all spaces. Necessary for regular expressions as well.
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
// If the expected target type is String, nothing to do...
return targetType == 'String'
? json
: _deserialize(jsonDecode(json), targetType, growable: growable == true);
}
{{/native_serialization}}
// ignore: deprecated_member_use_from_same_package
Future<String> serializeAsync(Object value) async => serialize(value);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.')
String serialize(Object value) => value == null ? '' : json.encode(value);
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
void _updateParamsForAuth(
List<String> authNames,
List<QueryParam> queryParams,
Map<String, String> headerParams,
) {
authNames.forEach((authName) {
final auth = _authentications[authName];
if (auth == null) {
throw ArgumentError('Authentication undefined: $authName');
}
auth.applyToParams(queryParams, headerParams);
});
}
{{#native_serialization}}
dynamic _deserialize(dynamic value, String targetType, {bool growable}) {
static dynamic _deserialize(dynamic value, String targetType, {bool growable}) {
try {
switch (targetType) {
case 'String':
@@ -180,57 +218,68 @@ class ApiClient {
default:
Match match;
if (value is List && (match = _regList.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return value
.map((v) => _deserialize(v, newTargetType, growable: growable))
.toList(growable: true == growable);
.map((v) => _deserialize(v, targetType, growable: growable))
.toList(growable: growable);
}
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return value
.map((v) => _deserialize(v, newTargetType, growable: growable))
.map((v) => _deserialize(v, targetType, growable: growable))
.toSet();
}
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return Map.fromIterables(
value.keys,
value.values.map((v) => _deserialize(v, newTargetType, growable: growable)),
value.values.map((v) => _deserialize(v, targetType, growable: growable)),
);
}
break;
}
} on Exception catch (e, stack) {
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', e, stack,);
} catch (error, trace) {
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
}
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
}
{{/native_serialization}}
}
{{#native_serialization}}
dynamic deserialize(String json, String targetType, {bool growable}) {
// Remove all spaces. Necessary for reg expressions as well.
targetType = targetType.replaceAll(' ', '');
/// Primarily intended for use in an isolate.
class DeserializationMessage {
const DeserializationMessage({
@required this.json,
@required this.targetType,
this.growable,
});
/// The JSON value to deserialize.
final String json;
/// Target type to deserialize to.
final String targetType;
/// Whether to make deserialized lists or maps growable.
final bool growable;
}
/// Primarily intended for use in an isolate.
Future<dynamic> deserializeAsync(DeserializationMessage message) async {
// Remove all spaces. Necessary for regular expressions as well.
final targetType = message.targetType.replaceAll(' ', '');
// If the expected target type is String, nothing to do...
return targetType == 'String'
? json
: _deserialize(jsonDecode(json), targetType, growable: true == growable);
}
? message.json
: ApiClient._deserialize(
jsonDecode(message.json),
targetType,
growable: message.growable == true,
);
}
{{/native_serialization}}
String serialize(Object obj) => obj == null ? '' : json.encode(obj);
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
void _updateParamsForAuth(
List<String> authNames,
List<QueryParam> queryParams,
Map<String, String> headerParams,
) {
authNames.forEach((authName) {
final auth = _authentications[authName];
if (auth == null) {
throw ArgumentError('Authentication undefined: $authName');
}
auth.applyToParams(queryParams, headerParams);
});
}
}
/// Primarily intended for use in an isolate.
Future<String> serializeAsync(Object value) async => value == null ? '' : json.encode(value);

View File

@@ -63,7 +63,7 @@ String parameterToString(dynamic value) {
/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json'
/// content type. Otherwise, returns the decoded body as decoded by dart:http package.
String _decodeBodyBytes(Response response) {
Future<String> _decodeBodyBytes(Response response) async {
final contentType = response.headers['content-type'];
return contentType != null && contentType.toLowerCase().startsWith('application/json')
? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)

View File

@@ -7,11 +7,10 @@ import 'dart:io';
import 'package:http/http.dart';
import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
{{#json_serializable}}
import 'package:json_annotation/json_annotation.dart';
{{/json_serializable}}
import 'package:meta/meta.dart';
part 'api_client.dart';
part 'api_helper.dart';

View File

@@ -460,7 +460,7 @@ public class PythonClientTest {
expectedValue = expectedValue.replaceAll("\\r\\n", "\n");
Assert.assertEquals(expectedValue.trim(), exampleValue.trim());
Assert.assertEquals(exampleValue.trim(), expectedValue.trim());
}

View File

@@ -1,9 +1,6 @@
GeoJsonGeometry(
type="GeometryCollection",
geometries=[
GeoJsonGeometry(
type="GeometryCollection",
geometries=[],
),
GeoJsonGeometry(),
],
)

View File

@@ -1546,6 +1546,11 @@ components:
enum:
- 1
- -1
enum_integer_only:
type: integer
enum:
- 2
- -2
enum_number:
type: number
format: double

View File

@@ -39,7 +39,6 @@ else()
find_package(cpprestsdk REQUIRED)
find_package(Boost REQUIRED)
find_package(pthreads REQUIRED)
endif()
# Manually set the cpprestsdk paths when not using package manager
@@ -68,9 +67,9 @@ target_link_directories(
)
if (UNIX)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprest pthread ${Boost_LIBRARIES} crypto)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${pthreads_LIBRARIES} ${Boost_LIBRARIES} bcrypt)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)

View File

@@ -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<YourApiClass>(httpClient =>
new PetApi(httpClient));
```
<a name="getting-started"></a>

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]

View File

@@ -101,44 +101,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public AnotherFakeApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public AnotherFakeApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -159,6 +276,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -94,44 +94,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public DefaultApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public DefaultApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="DefaultApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -152,6 +269,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -818,44 +818,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public FakeApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public FakeApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="FakeApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -876,6 +993,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -101,44 +101,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public FakeClassnameTags123Api(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public FakeClassnameTags123Api() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -159,6 +276,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -463,44 +463,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public PetApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public PetApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="PetApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -521,6 +638,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -226,44 +226,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public StoreApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public StoreApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="StoreApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -284,6 +401,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -398,44 +398,36 @@ namespace Org.OpenAPITools.Api
/// <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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <returns></returns>
public UserApi(HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false) : this((string)null, client, handler, disableHandlerFeatures)
public UserApi() : this((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="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class
/// using Configuration object
/// Initializes a new instance of the <see cref="UserApi"/> class using Configuration object.
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <param name="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="client">An instance of HttpClient.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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) : this(client, (string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </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>
/// <returns></returns>
/// <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)
{
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;
}
/// <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="configuration">An instance of Configuration.</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
/// <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, 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;
}
/// <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.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
@@ -456,6 +573,7 @@ namespace Org.OpenAPITools.Api
/// <param name="client">The client interface for synchronous API access.</param>
/// <param name="asyncClient">The client interface for asynchronous API access.</param>
/// <param name="configuration">The configuration object.</param>
/// <exception cref="ArgumentNullException"></exception>
public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");

View File

@@ -161,17 +161,17 @@ namespace Org.OpenAPITools.Client
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios),
/// encapsulating general REST accessor use cases.
/// </summary>
/// <remarks>
/// The Dispose method will manage the HttpClient lifecycle when not passed by constructor.
/// </remarks>
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;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
/// These settings can be adjusted to accomodate custom serialization rules.
@@ -192,37 +192,88 @@ namespace Org.OpenAPITools.Client
/// <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>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
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)
{
}
/// <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>
public ApiClient(String basePath)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty");
_httpClientHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpClientHandler, true);
_disposeClient = true;
_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.
/// 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)
{
}
/// <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>
/// <param name="client">An instance of HttpClient</param>
/// <param name="handler">An instance of HttpClientHandler that is used by HttpClient</param>
/// <param name="disableHandlerFeatures">Disable ApiClient features that require access to the HttpClientHandler</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public ApiClient(String basePath, HttpClient client = null, HttpClientHandler handler = null, bool disableHandlerFeatures = false)
/// <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 (string.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
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;
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;
/// <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>
/// 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;
}
/// <summary>
@@ -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<T> ToApiResponse<T>(HttpResponseMessage response, object responseData, HttpClientHandler handler, Uri uri)
private ApiResponse<T> ToApiResponse<T>(HttpResponseMessage response, object responseData, Uri uri)
{
T result = (T) responseData;
string rawContent = response.Content.ToString();
@@ -403,19 +451,16 @@ namespace Org.OpenAPITools.Client
}
}
if(!_disableHandlerFeatures)
{
if (response != null)
if (_httpClientHandler != null && response != null)
{
try {
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
}
}
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(_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)
{
handler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
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<Cookie> : 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<T>(response);
@@ -497,7 +542,7 @@ namespace Org.OpenAPITools.Client
InterceptResponse(req, response);
var result = ToApiResponse<T>(response, responseData, handler, req.RequestUri);
var result = ToApiResponse<T>(response, responseData, req.RequestUri);
return result;
}

View File

@@ -48,6 +48,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -46,6 +46,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -52,6 +52,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets JustSymbol
/// </summary>
@@ -78,6 +79,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets ArrayEnum
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumString
/// </summary>
@@ -89,6 +90,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumStringRequired
/// </summary>
@@ -111,12 +113,36 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumInteger
/// </summary>
[DataMember(Name = "enum_integer", EmitDefaultValue = false)]
public EnumIntegerEnum? EnumInteger { get; set; }
/// <summary>
/// Defines EnumIntegerOnly
/// </summary>
public enum EnumIntegerOnlyEnum
{
/// <summary>
/// Enum NUMBER_2 for value: 2
/// </summary>
NUMBER_2 = 2,
/// <summary>
/// Enum NUMBER_MINUS_2 for value: -2
/// </summary>
NUMBER_MINUS_2 = -2
}
/// <summary>
/// Gets or Sets EnumIntegerOnly
/// </summary>
[DataMember(Name = "enum_integer_only", EmitDefaultValue = false)]
public EnumIntegerOnlyEnum? EnumIntegerOnly { get; set; }
/// <summary>
/// Defines EnumNumber
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
@@ -136,26 +162,31 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumNumber
/// </summary>
[DataMember(Name = "enum_number", EmitDefaultValue = false)]
public EnumNumberEnum? EnumNumber { get; set; }
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name = "outerEnum", EmitDefaultValue = true)]
public OuterEnum? OuterEnum { get; set; }
/// <summary>
/// Gets or Sets OuterEnumInteger
/// </summary>
[DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)]
public OuterEnumInteger? OuterEnumInteger { get; set; }
/// <summary>
/// Gets or Sets OuterEnumDefaultValue
/// </summary>
[DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)]
public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; }
/// <summary>
/// Gets or Sets OuterEnumIntegerDefaultValue
/// </summary>
@@ -175,16 +206,18 @@ namespace Org.OpenAPITools.Model
/// <param name="enumString">enumString.</param>
/// <param name="enumStringRequired">enumStringRequired (required).</param>
/// <param name="enumInteger">enumInteger.</param>
/// <param name="enumIntegerOnly">enumIntegerOnly.</param>
/// <param name="enumNumber">enumNumber.</param>
/// <param name="outerEnum">outerEnum.</param>
/// <param name="outerEnumInteger">outerEnumInteger.</param>
/// <param name="outerEnumDefaultValue">outerEnumDefaultValue.</param>
/// <param name="outerEnumIntegerDefaultValue">outerEnumIntegerDefaultValue.</param>
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumIntegerOnlyEnum? enumIntegerOnly = default(EnumIntegerOnlyEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
{
this.EnumStringRequired = enumStringRequired;
this.EnumString = enumString;
this.EnumInteger = enumInteger;
this.EnumIntegerOnly = enumIntegerOnly;
this.EnumNumber = enumNumber;
this.OuterEnum = outerEnum;
this.OuterEnumInteger = outerEnumInteger;
@@ -210,6 +243,7 @@ namespace Org.OpenAPITools.Model
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n");
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n");
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n");
sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n");
@@ -261,6 +295,7 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.EnumString.GetHashCode();
hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode();
hashCode = hashCode * 59 + this.EnumInteger.GetHashCode();
hashCode = hashCode * 59 + this.EnumIntegerOnly.GetHashCode();
hashCode = hashCode * 59 + this.EnumNumber.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnum.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnumInteger.GetHashCode();

View File

@@ -53,6 +53,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets MapOfEnumString
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Order Status
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// pet status in the store
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets Type
/// </summary>

View File

@@ -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).
<a name="installation"></a>
## Installation

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]

View File

@@ -48,6 +48,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -46,6 +46,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -52,6 +52,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets JustSymbol
/// </summary>
@@ -78,6 +79,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets ArrayEnum
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumString
/// </summary>
@@ -89,6 +90,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumStringRequired
/// </summary>
@@ -111,12 +113,36 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumInteger
/// </summary>
[DataMember(Name = "enum_integer", EmitDefaultValue = false)]
public EnumIntegerEnum? EnumInteger { get; set; }
/// <summary>
/// Defines EnumIntegerOnly
/// </summary>
public enum EnumIntegerOnlyEnum
{
/// <summary>
/// Enum NUMBER_2 for value: 2
/// </summary>
NUMBER_2 = 2,
/// <summary>
/// Enum NUMBER_MINUS_2 for value: -2
/// </summary>
NUMBER_MINUS_2 = -2
}
/// <summary>
/// Gets or Sets EnumIntegerOnly
/// </summary>
[DataMember(Name = "enum_integer_only", EmitDefaultValue = false)]
public EnumIntegerOnlyEnum? EnumIntegerOnly { get; set; }
/// <summary>
/// Defines EnumNumber
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
@@ -136,26 +162,31 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumNumber
/// </summary>
[DataMember(Name = "enum_number", EmitDefaultValue = false)]
public EnumNumberEnum? EnumNumber { get; set; }
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name = "outerEnum", EmitDefaultValue = true)]
public OuterEnum? OuterEnum { get; set; }
/// <summary>
/// Gets or Sets OuterEnumInteger
/// </summary>
[DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)]
public OuterEnumInteger? OuterEnumInteger { get; set; }
/// <summary>
/// Gets or Sets OuterEnumDefaultValue
/// </summary>
[DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)]
public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; }
/// <summary>
/// Gets or Sets OuterEnumIntegerDefaultValue
/// </summary>
@@ -175,16 +206,18 @@ namespace Org.OpenAPITools.Model
/// <param name="enumString">enumString.</param>
/// <param name="enumStringRequired">enumStringRequired (required).</param>
/// <param name="enumInteger">enumInteger.</param>
/// <param name="enumIntegerOnly">enumIntegerOnly.</param>
/// <param name="enumNumber">enumNumber.</param>
/// <param name="outerEnum">outerEnum.</param>
/// <param name="outerEnumInteger">outerEnumInteger.</param>
/// <param name="outerEnumDefaultValue">outerEnumDefaultValue.</param>
/// <param name="outerEnumIntegerDefaultValue">outerEnumIntegerDefaultValue.</param>
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumIntegerOnlyEnum? enumIntegerOnly = default(EnumIntegerOnlyEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
{
this.EnumStringRequired = enumStringRequired;
this.EnumString = enumString;
this.EnumInteger = enumInteger;
this.EnumIntegerOnly = enumIntegerOnly;
this.EnumNumber = enumNumber;
this.OuterEnum = outerEnum;
this.OuterEnumInteger = outerEnumInteger;
@@ -210,6 +243,7 @@ namespace Org.OpenAPITools.Model
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n");
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n");
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n");
sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n");
@@ -261,6 +295,7 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.EnumString.GetHashCode();
hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode();
hashCode = hashCode * 59 + this.EnumInteger.GetHashCode();
hashCode = hashCode * 59 + this.EnumIntegerOnly.GetHashCode();
hashCode = hashCode * 59 + this.EnumNumber.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnum.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnumInteger.GetHashCode();

View File

@@ -53,6 +53,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets MapOfEnumString
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Order Status
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// pet status in the store
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets Type
/// </summary>

View File

@@ -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).
<a name="installation"></a>
## Installation

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]

View File

@@ -48,6 +48,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -46,6 +46,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -52,6 +52,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets JustSymbol
/// </summary>
@@ -78,6 +79,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets ArrayEnum
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumString
/// </summary>
@@ -89,6 +90,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumStringRequired
/// </summary>
@@ -111,12 +113,36 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumInteger
/// </summary>
[DataMember(Name = "enum_integer", EmitDefaultValue = false)]
public EnumIntegerEnum? EnumInteger { get; set; }
/// <summary>
/// Defines EnumIntegerOnly
/// </summary>
public enum EnumIntegerOnlyEnum
{
/// <summary>
/// Enum NUMBER_2 for value: 2
/// </summary>
NUMBER_2 = 2,
/// <summary>
/// Enum NUMBER_MINUS_2 for value: -2
/// </summary>
NUMBER_MINUS_2 = -2
}
/// <summary>
/// Gets or Sets EnumIntegerOnly
/// </summary>
[DataMember(Name = "enum_integer_only", EmitDefaultValue = false)]
public EnumIntegerOnlyEnum? EnumIntegerOnly { get; set; }
/// <summary>
/// Defines EnumNumber
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
@@ -136,26 +162,31 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumNumber
/// </summary>
[DataMember(Name = "enum_number", EmitDefaultValue = false)]
public EnumNumberEnum? EnumNumber { get; set; }
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name = "outerEnum", EmitDefaultValue = true)]
public OuterEnum? OuterEnum { get; set; }
/// <summary>
/// Gets or Sets OuterEnumInteger
/// </summary>
[DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)]
public OuterEnumInteger? OuterEnumInteger { get; set; }
/// <summary>
/// Gets or Sets OuterEnumDefaultValue
/// </summary>
[DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)]
public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; }
/// <summary>
/// Gets or Sets OuterEnumIntegerDefaultValue
/// </summary>
@@ -175,16 +206,18 @@ namespace Org.OpenAPITools.Model
/// <param name="enumString">enumString.</param>
/// <param name="enumStringRequired">enumStringRequired (required).</param>
/// <param name="enumInteger">enumInteger.</param>
/// <param name="enumIntegerOnly">enumIntegerOnly.</param>
/// <param name="enumNumber">enumNumber.</param>
/// <param name="outerEnum">outerEnum.</param>
/// <param name="outerEnumInteger">outerEnumInteger.</param>
/// <param name="outerEnumDefaultValue">outerEnumDefaultValue.</param>
/// <param name="outerEnumIntegerDefaultValue">outerEnumIntegerDefaultValue.</param>
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumIntegerOnlyEnum? enumIntegerOnly = default(EnumIntegerOnlyEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
{
this.EnumStringRequired = enumStringRequired;
this.EnumString = enumString;
this.EnumInteger = enumInteger;
this.EnumIntegerOnly = enumIntegerOnly;
this.EnumNumber = enumNumber;
this.OuterEnum = outerEnum;
this.OuterEnumInteger = outerEnumInteger;
@@ -210,6 +243,7 @@ namespace Org.OpenAPITools.Model
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n");
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n");
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n");
sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n");
@@ -261,6 +295,7 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.EnumString.GetHashCode();
hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode();
hashCode = hashCode * 59 + this.EnumInteger.GetHashCode();
hashCode = hashCode * 59 + this.EnumIntegerOnly.GetHashCode();
hashCode = hashCode * 59 + this.EnumNumber.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnum.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnumInteger.GetHashCode();

View File

@@ -53,6 +53,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets MapOfEnumString
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Order Status
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// pet status in the store
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets Type
/// </summary>

View File

@@ -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).
<a name="installation"></a>
## Installation

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]

View File

@@ -171,5 +171,17 @@ namespace Org.OpenAPITools.Test
OuterEnumInteger instance = OuterEnumInteger.NUMBER_1;
Assert.Equal(1, (int)instance);
}
/// <summary>
/// Test inner enum integer
/// </summary>
[Fact]
public void InnerEnumIntegerInstanceTest()
{
EnumTest enumTest = new EnumTest();
enumTest.EnumIntegerOnly = EnumTest.EnumIntegerOnlyEnum.NUMBER_2;
enumTest.EnumInteger = EnumTest.EnumIntegerEnum.NUMBER_MINUS_1;
Assert.Equal("{\"enum_integer\":-1,\"enum_integer_only\":2,\"outerEnum\":null}", JsonConvert.SerializeObject(enumTest));
}
}
}

View File

@@ -48,6 +48,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -46,6 +46,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -52,6 +52,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets JustSymbol
/// </summary>
@@ -78,6 +79,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets ArrayEnum
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumString
/// </summary>
@@ -89,6 +90,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumStringRequired
/// </summary>
@@ -111,12 +113,36 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumInteger
/// </summary>
[DataMember(Name = "enum_integer", EmitDefaultValue = false)]
public EnumIntegerEnum? EnumInteger { get; set; }
/// <summary>
/// Defines EnumIntegerOnly
/// </summary>
public enum EnumIntegerOnlyEnum
{
/// <summary>
/// Enum NUMBER_2 for value: 2
/// </summary>
NUMBER_2 = 2,
/// <summary>
/// Enum NUMBER_MINUS_2 for value: -2
/// </summary>
NUMBER_MINUS_2 = -2
}
/// <summary>
/// Gets or Sets EnumIntegerOnly
/// </summary>
[DataMember(Name = "enum_integer_only", EmitDefaultValue = false)]
public EnumIntegerOnlyEnum? EnumIntegerOnly { get; set; }
/// <summary>
/// Defines EnumNumber
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
@@ -136,26 +162,31 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumNumber
/// </summary>
[DataMember(Name = "enum_number", EmitDefaultValue = false)]
public EnumNumberEnum? EnumNumber { get; set; }
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name = "outerEnum", EmitDefaultValue = true)]
public OuterEnum? OuterEnum { get; set; }
/// <summary>
/// Gets or Sets OuterEnumInteger
/// </summary>
[DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)]
public OuterEnumInteger? OuterEnumInteger { get; set; }
/// <summary>
/// Gets or Sets OuterEnumDefaultValue
/// </summary>
[DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)]
public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; }
/// <summary>
/// Gets or Sets OuterEnumIntegerDefaultValue
/// </summary>
@@ -175,16 +206,18 @@ namespace Org.OpenAPITools.Model
/// <param name="enumString">enumString.</param>
/// <param name="enumStringRequired">enumStringRequired (required).</param>
/// <param name="enumInteger">enumInteger.</param>
/// <param name="enumIntegerOnly">enumIntegerOnly.</param>
/// <param name="enumNumber">enumNumber.</param>
/// <param name="outerEnum">outerEnum.</param>
/// <param name="outerEnumInteger">outerEnumInteger.</param>
/// <param name="outerEnumDefaultValue">outerEnumDefaultValue.</param>
/// <param name="outerEnumIntegerDefaultValue">outerEnumIntegerDefaultValue.</param>
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumIntegerOnlyEnum? enumIntegerOnly = default(EnumIntegerOnlyEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
{
this.EnumStringRequired = enumStringRequired;
this.EnumString = enumString;
this.EnumInteger = enumInteger;
this.EnumIntegerOnly = enumIntegerOnly;
this.EnumNumber = enumNumber;
this.OuterEnum = outerEnum;
this.OuterEnumInteger = outerEnumInteger;
@@ -210,6 +243,7 @@ namespace Org.OpenAPITools.Model
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n");
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n");
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n");
sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n");
@@ -261,6 +295,7 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.EnumString.GetHashCode();
hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode();
hashCode = hashCode * 59 + this.EnumInteger.GetHashCode();
hashCode = hashCode * 59 + this.EnumIntegerOnly.GetHashCode();
hashCode = hashCode * 59 + this.EnumNumber.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnum.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnumInteger.GetHashCode();

View File

@@ -53,6 +53,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets MapOfEnumString
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Order Status
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// pet status in the store
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets Type
/// </summary>

View File

@@ -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).
<a name="installation"></a>
## Installation

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**EnumString** | **string** | | [optional]
**EnumStringRequired** | **string** | |
**EnumInteger** | **int** | | [optional]
**EnumIntegerOnly** | **int** | | [optional]
**EnumNumber** | **double** | | [optional]
**OuterEnum** | **OuterEnum** | | [optional]
**OuterEnumInteger** | **OuterEnumInteger** | | [optional]

View File

@@ -48,6 +48,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -46,6 +46,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets PetType
/// </summary>

View File

@@ -52,6 +52,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets JustSymbol
/// </summary>
@@ -78,6 +79,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets ArrayEnum
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumString
/// </summary>
@@ -89,6 +90,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumStringRequired
/// </summary>
@@ -111,12 +113,36 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumInteger
/// </summary>
[DataMember(Name = "enum_integer", EmitDefaultValue = false)]
public EnumIntegerEnum? EnumInteger { get; set; }
/// <summary>
/// Defines EnumIntegerOnly
/// </summary>
public enum EnumIntegerOnlyEnum
{
/// <summary>
/// Enum NUMBER_2 for value: 2
/// </summary>
NUMBER_2 = 2,
/// <summary>
/// Enum NUMBER_MINUS_2 for value: -2
/// </summary>
NUMBER_MINUS_2 = -2
}
/// <summary>
/// Gets or Sets EnumIntegerOnly
/// </summary>
[DataMember(Name = "enum_integer_only", EmitDefaultValue = false)]
public EnumIntegerOnlyEnum? EnumIntegerOnly { get; set; }
/// <summary>
/// Defines EnumNumber
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
@@ -136,26 +162,31 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets EnumNumber
/// </summary>
[DataMember(Name = "enum_number", EmitDefaultValue = false)]
public EnumNumberEnum? EnumNumber { get; set; }
/// <summary>
/// Gets or Sets OuterEnum
/// </summary>
[DataMember(Name = "outerEnum", EmitDefaultValue = true)]
public OuterEnum? OuterEnum { get; set; }
/// <summary>
/// Gets or Sets OuterEnumInteger
/// </summary>
[DataMember(Name = "outerEnumInteger", EmitDefaultValue = false)]
public OuterEnumInteger? OuterEnumInteger { get; set; }
/// <summary>
/// Gets or Sets OuterEnumDefaultValue
/// </summary>
[DataMember(Name = "outerEnumDefaultValue", EmitDefaultValue = false)]
public OuterEnumDefaultValue? OuterEnumDefaultValue { get; set; }
/// <summary>
/// Gets or Sets OuterEnumIntegerDefaultValue
/// </summary>
@@ -172,16 +203,18 @@ namespace Org.OpenAPITools.Model
/// <param name="enumString">enumString.</param>
/// <param name="enumStringRequired">enumStringRequired (required).</param>
/// <param name="enumInteger">enumInteger.</param>
/// <param name="enumIntegerOnly">enumIntegerOnly.</param>
/// <param name="enumNumber">enumNumber.</param>
/// <param name="outerEnum">outerEnum.</param>
/// <param name="outerEnumInteger">outerEnumInteger.</param>
/// <param name="outerEnumDefaultValue">outerEnumDefaultValue.</param>
/// <param name="outerEnumIntegerDefaultValue">outerEnumIntegerDefaultValue.</param>
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumIntegerOnlyEnum? enumIntegerOnly = default(EnumIntegerOnlyEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?), OuterEnumInteger? outerEnumInteger = default(OuterEnumInteger?), OuterEnumDefaultValue? outerEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default(OuterEnumIntegerDefaultValue?))
{
this.EnumStringRequired = enumStringRequired;
this.EnumString = enumString;
this.EnumInteger = enumInteger;
this.EnumIntegerOnly = enumIntegerOnly;
this.EnumNumber = enumNumber;
this.OuterEnum = outerEnum;
this.OuterEnumInteger = outerEnumInteger;
@@ -200,6 +233,7 @@ namespace Org.OpenAPITools.Model
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n");
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n");
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n");
sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n");
@@ -250,6 +284,7 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.EnumString.GetHashCode();
hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode();
hashCode = hashCode * 59 + this.EnumInteger.GetHashCode();
hashCode = hashCode * 59 + this.EnumIntegerOnly.GetHashCode();
hashCode = hashCode * 59 + this.EnumNumber.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnum.GetHashCode();
hashCode = hashCode * 59 + this.OuterEnumInteger.GetHashCode();

View File

@@ -53,6 +53,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets MapOfEnumString
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Order Status
/// </summary>

View File

@@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// pet status in the store
/// </summary>

View File

@@ -58,6 +58,7 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Gets or Sets Type
/// </summary>

View File

@@ -39,7 +39,7 @@ void main() {
Future<dynamic> addPet(Pet pet) {
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(pet),
expectedPostRequestBody: await petApi.apiClient.serializeAsync(pet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
return petApi.addPet(pet);
@@ -53,7 +53,8 @@ void main() {
// use the pet api to add a pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(newPet),
expectedPostRequestBody:
await petApi.apiClient.serializeAsync(newPet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.addPet(newPet);
@@ -61,7 +62,7 @@ void main() {
// retrieve the same pet by id
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
getResponseBody: petApi.apiClient.serialize(newPet),
getResponseBody: await petApi.apiClient.serializeAsync(newPet),
);
final retrievedPet = await petApi.getPetById(id);
@@ -86,7 +87,8 @@ void main() {
// add a new pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(newPet),
expectedPostRequestBody:
await petApi.apiClient.serializeAsync(newPet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.addPet(newPet);
@@ -115,7 +117,8 @@ void main() {
// add a new pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(newPet),
expectedPostRequestBody:
await petApi.apiClient.serializeAsync(newPet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.addPet(newPet);
@@ -139,7 +142,7 @@ void main() {
newPet.name = 'Doge';
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
getResponseBody: petApi.apiClient.serialize(newPet),
getResponseBody: await petApi.apiClient.serializeAsync(newPet),
);
final pet = await petApi.getPetById(id);
expect(pet.name, equals('Doge'));
@@ -154,7 +157,8 @@ void main() {
// add a new pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(newPet),
expectedPostRequestBody:
await petApi.apiClient.serializeAsync(newPet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.addPet(newPet);
@@ -162,7 +166,8 @@ void main() {
// update the same pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPutRequestBody: petApi.apiClient.serialize(updatePet),
expectedPutRequestBody:
await petApi.apiClient.serializeAsync(updatePet),
putResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.updatePet(updatePet);
@@ -170,7 +175,7 @@ void main() {
// check update worked
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
getResponseBody: petApi.apiClient.serialize(updatePet),
getResponseBody: await petApi.apiClient.serializeAsync(updatePet),
);
final pet = await petApi.getPetById(id);
expect(pet.name, equals(name));
@@ -180,18 +185,20 @@ void main() {
final id1 = newId();
final id2 = newId();
final id3 = newId();
final status = PetStatusEnum.available.value;
final status = '${PetStatusEnum.available}';
final pet1 = makePet(id: id1, status: status);
final pet2 = makePet(id: id2, status: status);
final pet3 = makePet(id: id3, status: PetStatusEnum.sold.value);
final pet3 = makePet(id: id3, status: '${PetStatusEnum.sold}');
await addPet(pet1);
await addPet(pet2);
await addPet(pet3);
return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)])
.then((_) async {
// retrieve pets by status
petApi.apiClient.client = FakeClient(
expectedUrl:
'http://petstore.swagger.io/v2/pet/findByStatus?status=$status',
getResponseBody: petApi.apiClient.serialize([pet1, pet2]),
getResponseBody: await petApi.apiClient.serializeAsync([pet1, pet2]),
);
final pets = await petApi.findPetsByStatus([status]);
@@ -204,7 +211,6 @@ void main() {
expect(petIds, contains(id2));
expect(petIds, isNot(contains(id3)));
});
});
test('uploads a pet image', () async {
final id = newId();
@@ -216,7 +222,8 @@ void main() {
// add a new pet
petApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/pet',
expectedPostRequestBody: petApi.apiClient.serialize(newPet),
expectedPostRequestBody:
await petApi.apiClient.serializeAsync(newPet),
postResponseBody: '',
expectedHeaders: {'Content-Type': 'application/json'});
await petApi.addPet(newPet);

View File

@@ -81,20 +81,18 @@ void main() {
var id1 = newId();
var id2 = newId();
var id3 = newId();
var status = PetStatusEnum.available.value;
var status = '${PetStatusEnum.available}';
await petApi.addPet(makePet(id: id1, status: status));
await petApi.addPet(makePet(id: id2, status: status));
await petApi.addPet(makePet(id: id3, status: '${PetStatusEnum.sold}'));
return Future.wait([
petApi.addPet(makePet(id: id1, status: status)),
petApi.addPet(makePet(id: id2, status: status)),
petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold.value))
]).then((_) async {
var pets = await petApi.findPetsByStatus([status]);
var petIds = pets.map((pet) => pet.id).toList();
expect(petIds, contains(id1));
expect(petIds, contains(id2));
expect(petIds, isNot(contains(id3)));
});
});
test('uploads a pet image', () async {
var id = newId();

View File

@@ -28,8 +28,8 @@ void main() {
// // use the store api to add an order
// storeApi.apiClient.client = FakeClient(
// expectedUrl: 'http://petstore.swagger.io/v2/store/order',
// expectedPostRequestBody: storeApi.apiClient.serialize(newOrder),
// postResponseBody: storeApi.apiClient.serialize(newOrder),
// expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder),
// postResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
// expectedHeaders: {"Content-Type": "application/json"}
// );
// await storeApi.placeOrder(newOrder);
@@ -37,7 +37,7 @@ void main() {
// // retrieve the same order by id
// storeApi.apiClient.client = FakeClient(
// expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id',
// getResponseBody: storeApi.apiClient.serialize(newOrder),
// getResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
// );
// final placedOrder = await storeApi.getOrderById(id);
// expect(placedOrder.id, equals(id));
@@ -51,8 +51,8 @@ void main() {
// // use the store api to add an order
// storeApi.apiClient.client = FakeClient(
// expectedUrl: 'http://petstore.swagger.io/v2/store/order',
// expectedPostRequestBody: storeApi.apiClient.serialize(newOrder),
// postResponseBody: storeApi.apiClient.serialize(newOrder),
// expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder),
// postResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
// expectedHeaders: {"Content-Type": "application/json"}
// );
// await storeApi.placeOrder(newOrder);

View File

@@ -29,15 +29,16 @@ void main() {
// use the user api to create a user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user',
expectedPostRequestBody: userApi.apiClient.serialize(newUser),
postResponseBody: userApi.apiClient.serialize(newUser),
expectedPostRequestBody:
await userApi.apiClient.serializeAsync(newUser),
postResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
await userApi.createUser(newUser);
// retrieve the same user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user/$username',
getResponseBody: userApi.apiClient.serialize(newUser),
getResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
var user = await userApi.getUserByName(username);
expect(user.id, equals(id));
@@ -58,8 +59,8 @@ void main() {
// use the user api to create a list of users
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user/createWithList',
expectedPostRequestBody: userApi.apiClient.serialize(users),
postResponseBody: userApi.apiClient.serialize(users),
expectedPostRequestBody: await userApi.apiClient.serializeAsync(users),
postResponseBody: await userApi.apiClient.serializeAsync(users),
);
await userApi.createUsersWithListInput(users);
@@ -67,7 +68,7 @@ void main() {
userApi.apiClient.client = FakeClient(
expectedUrl:
'http://petstore.swagger.io/v2/user/${users.elementAt(0).username}',
getResponseBody: userApi.apiClient.serialize(
getResponseBody: await userApi.apiClient.serializeAsync(
users.elementAt(0),
),
);
@@ -75,7 +76,7 @@ void main() {
userApi.apiClient.client = FakeClient(
expectedUrl:
'http://petstore.swagger.io/v2/user/${users.elementAt(1).username}',
getResponseBody: userApi.apiClient.serialize(
getResponseBody: await userApi.apiClient.serializeAsync(
users.elementAt(1),
),
);
@@ -92,8 +93,9 @@ void main() {
// use the user api to create a user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user',
expectedPostRequestBody: userApi.apiClient.serialize(newUser),
postResponseBody: userApi.apiClient.serialize(newUser),
expectedPostRequestBody:
await userApi.apiClient.serializeAsync(newUser),
postResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
await userApi.createUser(newUser);
newUser.email = email;
@@ -101,15 +103,15 @@ void main() {
// use the user api to update the user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
expectedPutRequestBody: userApi.apiClient.serialize(newUser),
putResponseBody: userApi.apiClient.serialize(newUser),
expectedPutRequestBody: await userApi.apiClient.serializeAsync(newUser),
putResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
await userApi.updateUser(username, newUser);
// retrieve the same user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
getResponseBody: userApi.apiClient.serialize(newUser),
getResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
var foundUser = await userApi.getUserByName(username);
expect(foundUser.email, equals(email));
@@ -122,8 +124,9 @@ void main() {
// use the user api to create a user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user',
expectedPostRequestBody: userApi.apiClient.serialize(newUser),
postResponseBody: userApi.apiClient.serialize(newUser),
expectedPostRequestBody:
await userApi.apiClient.serializeAsync(newUser),
postResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
await userApi.createUser(newUser);
@@ -152,8 +155,9 @@ void main() {
// use the user api to create a user
userApi.apiClient.client = FakeClient(
expectedUrl: 'http://petstore.swagger.io/v2/user',
expectedPostRequestBody: userApi.apiClient.serialize(newUser),
postResponseBody: userApi.apiClient.serialize(newUser),
expectedPostRequestBody:
await userApi.apiClient.serializeAsync(newUser),
postResponseBody: await userApi.apiClient.serializeAsync(newUser),
);
await userApi.createUser(newUser);

View File

@@ -15,7 +15,6 @@ import 'dart:io';
import 'package:http/http.dart';
import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
part 'api_client.dart';

View File

@@ -74,7 +74,7 @@ class PetApi {
Future<void> addPet(Pet body) async {
final response = await addPetWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -146,7 +146,7 @@ class PetApi {
Future<void> deletePet(int petId, { String apiKey }) async {
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -215,13 +215,13 @@ class PetApi {
Future<List<Pet>> findPetsByStatus(List<String> status) async {
final response = await findPetsByStatusWithHttpInfo(status);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List)
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List<Pet>') as List)
.cast<Pet>()
.toList(growable: false);
}
@@ -293,13 +293,13 @@ class PetApi {
Future<List<Pet>> findPetsByTags(List<String> tags) async {
final response = await findPetsByTagsWithHttpInfo(tags);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List)
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List<Pet>') as List)
.cast<Pet>()
.toList(growable: false);
}
@@ -370,13 +370,13 @@ class PetApi {
Future<Pet> getPetById(int petId) async {
final response = await getPetByIdWithHttpInfo(petId);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
}
return Future<Pet>.value(null);
}
@@ -440,7 +440,7 @@ class PetApi {
Future<void> updatePet(Pet body) async {
final response = await updatePetWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -530,7 +530,7 @@ class PetApi {
Future<void> updatePetWithForm(int petId, { String name, String status }) async {
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -618,13 +618,13 @@ class PetApi {
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse;
}
return Future<ApiResponse>.value(null);
}

View File

@@ -79,7 +79,7 @@ class StoreApi {
Future<void> deleteOrder(String orderId) async {
final response = await deleteOrderWithHttpInfo(orderId);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -131,13 +131,13 @@ class StoreApi {
Future<Map<String, int>> getInventory() async {
final response = await getInventoryWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
return Map<String, int>.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map<String, int>'),);
}
return Future<Map<String, int>>.value(null);
}
@@ -206,13 +206,13 @@ class StoreApi {
Future<Order> getOrderById(int orderId) async {
final response = await getOrderByIdWithHttpInfo(orderId);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
}
return Future<Order>.value(null);
}
@@ -276,13 +276,13 @@ class StoreApi {
Future<Order> placeOrder(Order body) async {
final response = await placeOrderWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
}
return Future<Order>.value(null);
}

View File

@@ -78,7 +78,7 @@ class UserApi {
Future<void> createUser(User body) async {
final response = await createUserWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -141,7 +141,7 @@ class UserApi {
Future<void> createUsersWithArrayInput(List<User> body) async {
final response = await createUsersWithArrayInputWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -204,7 +204,7 @@ class UserApi {
Future<void> createUsersWithListInput(List<User> body) async {
final response = await createUsersWithListInputWithHttpInfo(body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -272,7 +272,7 @@ class UserApi {
Future<void> deleteUser(String username) async {
final response = await deleteUserWithHttpInfo(username);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -336,13 +336,13 @@ class UserApi {
Future<User> getUserByName(String username) async {
final response = await getUserByNameWithHttpInfo(username);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User;
}
return Future<User>.value(null);
}
@@ -418,13 +418,13 @@ class UserApi {
Future<String> loginUser(String username, String password) async {
final response = await loginUserWithHttpInfo(username, password);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
}
return Future<String>.value(null);
}
@@ -473,7 +473,7 @@ class UserApi {
Future<void> logoutUser() async {
final response = await logoutUserWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
@@ -550,7 +550,7 @@ class UserApi {
Future<void> updateUser(String username, User body) async {
final response = await updateUserWithHttpInfo(username, body);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
}

View File

@@ -44,17 +44,16 @@ class ApiClient {
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
/// returns an unmodifiable view of the authentications, since none should be added
/// nor deleted
Map<String, Authentication> get authentications =>
Map.unmodifiable(_authentications);
/// Returns an unmodifiable [Map] of the authentications, since none should be added
/// or deleted.
Map<String, Authentication> get authentications => Map.unmodifiable(_authentications);
T getAuthentication<T extends Authentication>(String name) {
final authentication = _authentications[name];
return authentication is T ? authentication : null;
}
// We dont use a Map<String, String> for queryParams.
// We don't use a Map<String, String> for queryParams.
// If collectionFormat is 'multi', a key might appear multiple times.
Future<Response> invokeAPI(
String path,
@@ -85,7 +84,7 @@ class ApiClient {
}
try {
// Special case for uploading a single file which isnt a 'multipart/form-data'.
// Special case for uploading a single file which isn't a 'multipart/form-data'.
if (
body is MultipartFile && (nullableContentType == null ||
!nullableContentType.toLowerCase().startsWith('multipart/form-data'))
@@ -115,7 +114,7 @@ class ApiClient {
final msgBody = nullableContentType == 'application/x-www-form-urlencoded'
? formParams
: serialize(body);
: await serializeAsync(body);
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
switch(method) {
@@ -141,7 +140,44 @@ class ApiClient {
throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',);
}
dynamic _deserialize(dynamic value, String targetType, {bool growable}) {
Future<dynamic> deserializeAsync(String json, String targetType, {bool growable}) async =>
// ignore: deprecated_member_use_from_same_package
deserialize(json, targetType, growable: growable);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
dynamic deserialize(String json, String targetType, {bool growable}) {
// Remove all spaces. Necessary for regular expressions as well.
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
// If the expected target type is String, nothing to do...
return targetType == 'String'
? json
: _deserialize(jsonDecode(json), targetType, growable: growable == true);
}
// ignore: deprecated_member_use_from_same_package
Future<String> serializeAsync(Object value) async => serialize(value);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.')
String serialize(Object value) => value == null ? '' : json.encode(value);
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
void _updateParamsForAuth(
List<String> authNames,
List<QueryParam> queryParams,
Map<String, String> headerParams,
) {
authNames.forEach((authName) {
final auth = _authentications[authName];
if (auth == null) {
throw ArgumentError('Authentication undefined: $authName');
}
auth.applyToParams(queryParams, headerParams);
});
}
static dynamic _deserialize(dynamic value, String targetType, {bool growable}) {
try {
switch (targetType) {
case 'String':
@@ -172,56 +208,65 @@ class ApiClient {
default:
Match match;
if (value is List && (match = _regList.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return value
.map((v) => _deserialize(v, newTargetType, growable: growable))
.toList(growable: true == growable);
.map((v) => _deserialize(v, targetType, growable: growable))
.toList(growable: growable);
}
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return value
.map((v) => _deserialize(v, newTargetType, growable: growable))
.map((v) => _deserialize(v, targetType, growable: growable))
.toSet();
}
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
final newTargetType = match[1];
targetType = match[1]; // ignore: parameter_assignments
return Map.fromIterables(
value.keys,
value.values.map((v) => _deserialize(v, newTargetType, growable: growable)),
value.values.map((v) => _deserialize(v, targetType, growable: growable)),
);
}
break;
}
} on Exception catch (e, stack) {
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', e, stack,);
} catch (error, trace) {
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
}
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
}
dynamic deserialize(String json, String targetType, {bool growable}) {
// Remove all spaces. Necessary for reg expressions as well.
targetType = targetType.replaceAll(' ', '');
return targetType == 'String'
? json
: _deserialize(jsonDecode(json), targetType, growable: true == growable);
}
String serialize(Object obj) => obj == null ? '' : json.encode(obj);
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
void _updateParamsForAuth(
List<String> authNames,
List<QueryParam> queryParams,
Map<String, String> headerParams,
) {
authNames.forEach((authName) {
final auth = _authentications[authName];
if (auth == null) {
throw ArgumentError('Authentication undefined: $authName');
}
auth.applyToParams(queryParams, headerParams);
});
}
}
/// Primarily intended for use in an isolate.
class DeserializationMessage {
const DeserializationMessage({
@required this.json,
@required this.targetType,
this.growable,
});
/// The JSON value to deserialize.
final String json;
/// Target type to deserialize to.
final String targetType;
/// Whether to make deserialized lists or maps growable.
final bool growable;
}
/// Primarily intended for use in an isolate.
Future<dynamic> deserializeAsync(DeserializationMessage message) async {
// Remove all spaces. Necessary for regular expressions as well.
final targetType = message.targetType.replaceAll(' ', '');
// If the expected target type is String, nothing to do...
return targetType == 'String'
? message.json
: ApiClient._deserialize(
jsonDecode(message.json),
targetType,
growable: message.growable == true,
);
}
/// Primarily intended for use in an isolate.
Future<String> serializeAsync(Object value) async => value == null ? '' : json.encode(value);

View File

@@ -63,7 +63,7 @@ String parameterToString(dynamic value) {
/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json'
/// content type. Otherwise, returns the decoded body as decoded by dart:http package.
String _decodeBodyBytes(Response response) {
Future<String> _decodeBodyBytes(Response response) async {
final contentType = response.headers['content-type'];
return contentType != null && contentType.toLowerCase().startsWith('application/json')
? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)

View File

@@ -842,13 +842,13 @@ with petstore_api.ApiClient(configuration) as api_client:
api_instance = fake_api.FakeApi(api_client)
number = 32.1 # float | None
double = 67.8 # float | None
pattern_without_delimiter = "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C" # str | None
pattern_without_delimiter = "Aj" # str | None
byte = 'YQ==' # str | None
integer = 10 # int | None (optional)
int32 = 20 # int | None (optional)
int64 = 1 # int | None (optional)
float = 3.14 # float | None (optional)
string = "a" # str | None (optional)
string = "A" # str | None (optional)
binary = open('/path/to/file', 'rb') # file_type | None (optional)
date = dateutil_parser('1970-01-01').date() # date | None (optional)
date_time = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | None (optional)

View File

@@ -47,28 +47,19 @@ class Openapi {
void setOAuthToken(String name, String token) {
if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) {
(this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor)
as OAuthInterceptor)
.tokens[name] = token;
(this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token;
}
}
void setBasicAuth(String name, String username, String password) {
if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) {
(this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor)
as BasicAuthInterceptor)
.authInfo[name] = BasicAuthInfo(username, password);
(this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
}
}
void setApiKey(String name, String apiKey) {
if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) {
(this
.dio
.interceptors
.firstWhere((element) => element is ApiKeyAuthInterceptor)
as ApiKeyAuthInterceptor)
.apiKeys[name] = apiKey;
(this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
}
}

View File

@@ -10,6 +10,7 @@ import 'package:dio/dio.dart';
import 'package:openapi/src/model/model_client.dart';
class AnotherFakeApi {
final Dio _dio;
final Serializers _serializers;
@@ -44,14 +45,16 @@ class AnotherFakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(ModelClient);
_bodyData = _serializers.serialize(modelClient, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -81,6 +84,7 @@ class AnotherFakeApi {
_response.data!,
specifiedType: _responseType,
) as ModelClient;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -101,4 +105,5 @@ class AnotherFakeApi {
extra: _response.extra,
);
}
}

View File

@@ -10,6 +10,7 @@ import 'package:dio/dio.dart';
import 'package:openapi/src/model/inline_response_default.dart';
class DefaultApi {
final Dio _dio;
final Serializers _serializers;
@@ -43,7 +44,8 @@ class DefaultApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -62,6 +64,7 @@ class DefaultApi {
_response.data!,
specifiedType: _responseType,
) as InlineResponseDefault;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -82,4 +85,5 @@ class DefaultApi {
extra: _response.extra,
);
}
}

View File

@@ -19,6 +19,7 @@ import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
class FakeApi {
final Dio _dio;
final Serializers _serializers;
@@ -52,7 +53,8 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -71,6 +73,7 @@ class FakeApi {
_response.data!,
specifiedType: _responseType,
) as HealthCheckResult;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -138,7 +141,8 @@ class FakeApi {
try {
const _type = FullType(Pet);
_bodyData = _serializers.serialize(pet, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -191,13 +195,15 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = body;
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -223,6 +229,7 @@ class FakeApi {
try {
_responseData = _response.data as bool;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -272,16 +279,16 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(OuterComposite);
_bodyData = outerComposite == null
? null
: _serializers.serialize(outerComposite, specifiedType: _type);
} catch (error) {
_bodyData = outerComposite == null ? null : _serializers.serialize(outerComposite, specifiedType: _type);
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -311,6 +318,7 @@ class FakeApi {
_response.data!,
specifiedType: _responseType,
) as OuterComposite;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -360,13 +368,15 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = body;
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -392,6 +402,7 @@ class FakeApi {
try {
_responseData = _response.data as num;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -441,13 +452,15 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = body;
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -473,6 +486,7 @@ class FakeApi {
try {
_responseData = _response.data as String;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -497,8 +511,7 @@ class FakeApi {
///
///
/// Test serialization of enum (int) properties with examples
Future<Response<OuterObjectWithEnumProperty>>
fakePropertyEnumIntegerSerialize({
Future<Response<OuterObjectWithEnumProperty>> fakePropertyEnumIntegerSerialize({
required OuterObjectWithEnumProperty outerObjectWithEnumProperty,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
@@ -523,15 +536,16 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(OuterObjectWithEnumProperty);
_bodyData = _serializers.serialize(outerObjectWithEnumProperty,
specifiedType: _type);
} catch (error) {
_bodyData = _serializers.serialize(outerObjectWithEnumProperty, specifiedType: _type);
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -561,6 +575,7 @@ class FakeApi {
_response.data!,
specifiedType: _responseType,
) as OuterObjectWithEnumProperty;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -610,15 +625,16 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(FileSchemaTestClass);
_bodyData =
_serializers.serialize(fileSchemaTestClass, specifiedType: _type);
} catch (error) {
_bodyData = _serializers.serialize(fileSchemaTestClass, specifiedType: _type);
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -681,7 +697,8 @@ class FakeApi {
try {
const _type = FullType(User);
_bodyData = _serializers.serialize(user, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -734,14 +751,16 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(ModelClient);
_bodyData = _serializers.serialize(modelClient, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -771,6 +790,7 @@ class FakeApi {
_response.data!,
specifiedType: _responseType,
) as ModelClient;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -838,51 +858,30 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = <String, dynamic>{
if (integer != null)
r'integer':
encodeFormParameter(_serializers, integer, const FullType(int)),
if (int32 != null)
r'int32':
encodeFormParameter(_serializers, int32, const FullType(int)),
if (int64 != null)
r'int64':
encodeFormParameter(_serializers, int64, const FullType(int)),
r'number':
encodeFormParameter(_serializers, number, const FullType(num)),
if (float != null)
r'float':
encodeFormParameter(_serializers, float, const FullType(double)),
r'double':
encodeFormParameter(_serializers, double_, const FullType(double)),
if (string != null)
r'string':
encodeFormParameter(_serializers, string, const FullType(String)),
r'pattern_without_delimiter': encodeFormParameter(
_serializers, patternWithoutDelimiter, const FullType(String)),
r'byte':
encodeFormParameter(_serializers, byte, const FullType(String)),
if (binary != null)
r'binary': MultipartFile.fromBytes(binary, filename: r'binary'),
if (date != null)
r'date':
encodeFormParameter(_serializers, date, const FullType(DateTime)),
if (dateTime != null)
r'dateTime': encodeFormParameter(
_serializers, dateTime, const FullType(DateTime)),
if (password != null)
r'password': encodeFormParameter(
_serializers, password, const FullType(String)),
if (callback != null)
r'callback': encodeFormParameter(
_serializers, callback, const FullType(String)),
if (integer != null) r'integer': encodeFormParameter(_serializers, integer, const FullType(int)),
if (int32 != null) r'int32': encodeFormParameter(_serializers, int32, const FullType(int)),
if (int64 != null) r'int64': encodeFormParameter(_serializers, int64, const FullType(int)),
r'number': encodeFormParameter(_serializers, number, const FullType(num)),
if (float != null) r'float': encodeFormParameter(_serializers, float, const FullType(double)),
r'double': encodeFormParameter(_serializers, double_, const FullType(double)),
if (string != null) r'string': encodeFormParameter(_serializers, string, const FullType(String)),
r'pattern_without_delimiter': encodeFormParameter(_serializers, patternWithoutDelimiter, const FullType(String)),
r'byte': encodeFormParameter(_serializers, byte, const FullType(String)),
if (binary != null) r'binary': MultipartFile.fromBytes(binary, filename: r'binary'),
if (date != null) r'date': encodeFormParameter(_serializers, date, const FullType(DateTime)),
if (dateTime != null) r'dateTime': encodeFormParameter(_serializers, dateTime, const FullType(DateTime)),
if (password != null) r'password': encodeFormParameter(_serializers, password, const FullType(String)),
if (callback != null) r'callback': encodeFormParameter(_serializers, callback, const FullType(String)),
};
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -930,8 +929,7 @@ class FakeApi {
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
if (enumHeaderStringArray != null)
r'enum_header_string_array': enumHeaderStringArray,
if (enumHeaderStringArray != null) r'enum_header_string_array': enumHeaderStringArray,
if (enumHeaderString != null) r'enum_header_string': enumHeaderString,
...?headers,
},
@@ -946,8 +944,7 @@ class FakeApi {
);
final _queryParameters = <String, dynamic>{
if (enumQueryStringArray != null)
r'enum_query_string_array': enumQueryStringArray,
if (enumQueryStringArray != null) r'enum_query_string_array': enumQueryStringArray,
if (enumQueryString != null) r'enum_query_string': enumQueryString,
if (enumQueryInteger != null) r'enum_query_integer': enumQueryInteger,
if (enumQueryDouble != null) r'enum_query_double': enumQueryDouble,
@@ -957,16 +954,11 @@ class FakeApi {
try {
_bodyData = <String, dynamic>{
if (enumFormStringArray != null)
r'enum_form_string_array': encodeFormParameter(
_serializers,
enumFormStringArray,
const FullType(BuiltList, [FullType(String)])),
if (enumFormString != null)
r'enum_form_string': encodeFormParameter(
_serializers, enumFormString, const FullType(String)),
if (enumFormStringArray != null) r'enum_form_string_array': encodeFormParameter(_serializers, enumFormStringArray, const FullType(BuiltList, [FullType(String)])),
if (enumFormString != null) r'enum_form_string': encodeFormParameter(_serializers, enumFormString, const FullType(String)),
};
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -1078,14 +1070,16 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(BuiltMap, [FullType(String), FullType(String)]);
_bodyData = _serializers.serialize(requestBody, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -1139,18 +1133,18 @@ class FakeApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = <String, dynamic>{
r'param':
encodeFormParameter(_serializers, param, const FullType(String)),
r'param2':
encodeFormParameter(_serializers, param2, const FullType(String)),
r'param': encodeFormParameter(_serializers, param, const FullType(String)),
r'param2': encodeFormParameter(_serializers, param2, const FullType(String)),
};
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -1226,4 +1220,5 @@ class FakeApi {
return _response;
}
}

View File

@@ -10,6 +10,7 @@ import 'package:dio/dio.dart';
import 'package:openapi/src/model/model_client.dart';
class FakeClassnameTags123Api {
final Dio _dio;
final Serializers _serializers;
@@ -51,14 +52,16 @@ class FakeClassnameTags123Api {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(ModelClient);
_bodyData = _serializers.serialize(modelClient, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -88,6 +91,7 @@ class FakeClassnameTags123Api {
_response.data!,
specifiedType: _responseType,
) as ModelClient;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -108,4 +112,5 @@ class FakeClassnameTags123Api {
extra: _response.extra,
);
}
}

View File

@@ -14,6 +14,7 @@ import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
class PetApi {
final Dio _dio;
final Serializers _serializers;
@@ -54,14 +55,16 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(Pet);
_bodyData = _serializers.serialize(pet, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -99,8 +102,7 @@ class PetApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path =
r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
@@ -122,7 +124,8 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -190,6 +193,7 @@ class PetApi {
_response.data!,
specifiedType: _responseType,
) as BuiltList<Pet>;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -265,6 +269,7 @@ class PetApi {
_response.data!,
specifiedType: _responseType,
) as BuiltSet<Pet>;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -298,8 +303,7 @@ class PetApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path =
r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
@@ -322,7 +326,8 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -341,6 +346,7 @@ class PetApi {
_response.data!,
specifiedType: _responseType,
) as Pet;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -396,14 +402,16 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(Pet);
_bodyData = _serializers.serialize(pet, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -442,8 +450,7 @@ class PetApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path =
r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@@ -464,20 +471,18 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = <String, dynamic>{
if (name != null)
r'name':
encodeFormParameter(_serializers, name, const FullType(String)),
if (status != null)
r'status':
encodeFormParameter(_serializers, status, const FullType(String)),
if (name != null) r'name': encodeFormParameter(_serializers, name, const FullType(String)),
if (status != null) r'status': encodeFormParameter(_serializers, status, const FullType(String)),
};
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -516,8 +521,7 @@ class PetApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/pet/{petId}/uploadImage'
.replaceAll('{' r'petId' '}', petId.toString());
final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@@ -538,19 +542,18 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = FormData.fromMap(<String, dynamic>{
if (additionalMetadata != null)
r'additionalMetadata': encodeFormParameter(
_serializers, additionalMetadata, const FullType(String)),
if (file != null)
r'file': MultipartFile.fromBytes(file, filename: r'file'),
if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)),
if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'),
});
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -580,6 +583,7 @@ class PetApi {
_response.data!,
specifiedType: _responseType,
) as ApiResponse;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -615,8 +619,7 @@ class PetApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/fake/{petId}/uploadImageWithRequiredFile'
.replaceAll('{' r'petId' '}', petId.toString());
final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString());
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
@@ -637,19 +640,18 @@ class PetApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
_bodyData = FormData.fromMap(<String, dynamic>{
if (additionalMetadata != null)
r'additionalMetadata': encodeFormParameter(
_serializers, additionalMetadata, const FullType(String)),
r'requiredFile':
MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'),
if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)),
r'requiredFile': MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'),
});
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -679,6 +681,7 @@ class PetApi {
_response.data!,
specifiedType: _responseType,
) as ApiResponse;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -699,4 +702,5 @@ class PetApi {
extra: _response.extra,
);
}
}

View File

@@ -11,6 +11,7 @@ import 'package:openapi/src/model/order.dart';
import 'package:built_collection/built_collection.dart';
class StoreApi {
final Dio _dio;
final Serializers _serializers;
@@ -29,8 +30,7 @@ class StoreApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/store/order/{order_id}'
.replaceAll('{' r'order_id' '}', orderId.toString());
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
@@ -46,7 +46,8 @@ class StoreApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -94,7 +95,8 @@ class StoreApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -108,12 +110,12 @@ class StoreApi {
BuiltMap<String, int> _responseData;
try {
const _responseType =
FullType(BuiltMap, [FullType(String), FullType(int)]);
const _responseType = FullType(BuiltMap, [FullType(String), FullType(int)]);
_responseData = _serializers.deserialize(
_response.data!,
specifiedType: _responseType,
) as BuiltMap<String, int>;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -147,8 +149,7 @@ class StoreApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/store/order/{order_id}'
.replaceAll('{' r'order_id' '}', orderId.toString());
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
@@ -164,7 +165,8 @@ class StoreApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -183,6 +185,7 @@ class StoreApi {
_response.data!,
specifiedType: _responseType,
) as Order;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -232,14 +235,16 @@ class StoreApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(Order);
_bodyData = _serializers.serialize(order, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -269,6 +274,7 @@ class StoreApi {
_response.data!,
specifiedType: _responseType,
) as Order;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -289,4 +295,5 @@ class StoreApi {
extra: _response.extra,
);
}
}

View File

@@ -11,6 +11,7 @@ import 'package:openapi/src/model/user.dart';
import 'package:built_collection/built_collection.dart';
class UserApi {
final Dio _dio;
final Serializers _serializers;
@@ -45,14 +46,16 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(User);
_bodyData = _serializers.serialize(user, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -105,14 +108,16 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(BuiltList, [FullType(User)]);
_bodyData = _serializers.serialize(user, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -165,14 +170,16 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(BuiltList, [FullType(User)]);
_bodyData = _serializers.serialize(user, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -209,8 +216,7 @@ class UserApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/user/{username}'
.replaceAll('{' r'username' '}', username.toString());
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
final _options = Options(
method: r'DELETE',
headers: <String, dynamic>{
@@ -226,7 +232,8 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -252,8 +259,7 @@ class UserApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/user/{username}'
.replaceAll('{' r'username' '}', username.toString());
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
@@ -269,7 +275,8 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -288,6 +295,7 @@ class UserApi {
_response.data!,
specifiedType: _responseType,
) as User;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -356,6 +364,7 @@ class UserApi {
try {
_responseData = _response.data as String;
} catch (error) {
throw DioError(
requestOptions: _response.requestOptions,
@@ -404,7 +413,8 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
final _response = await _dio.request<Object>(
_path,
@@ -431,8 +441,7 @@ class UserApi {
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/user/{username}'
.replaceAll('{' r'username' '}', username.toString());
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
final _options = Options(
method: r'PUT',
headers: <String, dynamic>{
@@ -448,14 +457,16 @@ class UserApi {
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{};
final _queryParameters = <String, dynamic>{
};
dynamic _bodyData;
try {
const _type = FullType(User);
_bodyData = _serializers.serialize(user, specifiedType: _type);
} catch (error) {
} catch(error) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
@@ -479,4 +490,5 @@ class UserApi {
return _response;
}
}

View File

@@ -10,8 +10,7 @@ import 'package:built_value/serializer.dart';
/// Format the given form parameter object into something that Dio can handle.
/// Returns primitive or String.
/// Returns List/Map if the value is BuildList/BuiltMap.
dynamic encodeFormParameter(
Serializers serializers, dynamic value, FullType type) {
dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) {
if (value == null) {
return '';
}

Some files were not shown because too many files have changed in this diff Show More