[csharp-netcore] Inject json options (#11862)

* refactor nrt annotation

* enable nrt by default in .net6.0+

* use shorter nrt annotation

* build samples

* removed debugging lines

* fixed model and operatoin constructors

* reverted a commented line for comparison

* upgraded to System.Text.Json

* build samples

* build samples

* deleted samples to remove old files

* bug fixes

* bug fixes

* added cumpulsory property to codegen

* build samples

* fixed bug

* fixed bug

* fixes

* removed bugged code that wasnt needed

* build samples

* restored sorting and default values for required params

* fixed bugs in comparison

* fixed sort comparators

* recreate tests

* build samples...again...

* removed debugging line breaks

* simplified constructor signature

* inject json options

* build samples...again...

* build samples
This commit is contained in:
devhl-labs 2022-03-30 04:59:05 -04:00 committed by GitHub
parent 6a3a385f8c
commit 40d3331e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
227 changed files with 895 additions and 1066 deletions

View File

@ -899,7 +899,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
}
public void addGenericHostSupportingFiles(final String clientPackageDir, final String packageFolder,
final AtomicReference<Boolean> excludeTests, final String testPackageFolder, final String testPackageName, final String modelPackageDir) {
final AtomicReference<Boolean> excludeTests, final String testPackageFolder, final String testPackageName, final String modelPackageDir) {
supportingFiles.add(new SupportingFile("TokenProvider`1.mustache", clientPackageDir, "TokenProvider`1.cs"));
supportingFiles.add(new SupportingFile("RateLimitProvider`1.mustache", clientPackageDir, "RateLimitProvider`1.cs"));
supportingFiles.add(new SupportingFile("TokenContainer`1.mustache", clientPackageDir, "TokenContainer`1.cs"));
@ -919,6 +919,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateJsonConverter.cs"));
supportingFiles.add(new SupportingFile("ApiResponseEventArgs.mustache", clientPackageDir, "ApiResponseEventArgs.cs"));
supportingFiles.add(new SupportingFile("IApi.mustache", clientPackageDir, getInterfacePrefix() + "Api.cs"));
supportingFiles.add(new SupportingFile("JsonSerializerOptionsProvider.mustache", clientPackageDir, "JsonSerializerOptionsProvider.cs"));
String apiTestFolder = testFolder + File.separator + testPackageName() + File.separator + apiPackage();

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
namespace {{packageName}}.Client

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
namespace {{packageName}}.Client

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Collections.Generic;
using System.Net;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Threading;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Threading;

View File

@ -1,16 +1,20 @@
{{>partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;{{#supportsRetry}}
using Polly.Timeout;
using Polly.Extensions.Http;
using Polly;{{/supportsRetry}}
using System.Net.Http;
using {{packageName}}.Api;{{#useCompareNetObjects}}
using KellermanSoftware.CompareNetObjects;{{/useCompareNetObjects}}
@ -53,11 +57,11 @@ namespace {{packageName}}.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, System.Text.Json.JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
public static bool TryDeserialize<T>(string json, JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(json, options);
result = JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
catch (Exception)
@ -75,11 +79,11 @@ namespace {{packageName}}.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOptions options, {{^netStandard}}[System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/netStandard}}out T{{#nrt}}{{^netStandard}}?{{/netStandard}}{{/nrt}} result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(ref reader, options);
result = JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
@ -89,11 +93,6 @@ namespace {{packageName}}.Client
}
}
/// <summary>
/// Json serializer options
/// </summary>
public static System.Text.Json.JsonSerializerOptions JsonSerializerOptions { get; set; } = new System.Text.Json.JsonSerializerOptions();
/// <summary>
/// Sanitize filename by removing the path
/// </summary>
@ -280,6 +279,25 @@ namespace {{packageName}}.Client
/// </summary>
public const string ISO8601_DATETIME_FORMAT = "o";
{{^hasAuthMethods}}
/// <summary>
/// Add the api to your host builder.
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
public static IHostBuilder Configure{{apiName}}(this IHostBuilder builder)
{
builder.ConfigureServices((context, services) =>
{
HostConfiguration config = new HostConfiguration(services);
Add{{apiName}}(services, config);
});
return builder;
}
{{/hasAuthMethods}}
/// <summary>
/// Add the api to your host builder.
/// </summary>
@ -299,6 +317,19 @@ namespace {{packageName}}.Client
return builder;
}
{{^hasAuthMethods}}
/// <summary>
/// Add the api to your host builder.
/// </summary>
/// <param name="services"></param>
/// <param name="options"></param>
public static void Add{{apiName}}(this IServiceCollection services)
{
HostConfiguration config = new HostConfiguration(services);
Add{{apiName}}(services, config);
}
{{/hasAuthMethods}}
/// <summary>
/// Add the api to your host builder.
/// </summary>

View File

@ -1,8 +1,13 @@
{{>partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using {{packageName}}.Api;
@ -16,6 +21,8 @@ namespace {{packageName}}.Client
public class HostConfiguration
{
private readonly IServiceCollection _services;
private JsonSerializerOptions _jsonOptions = new JsonSerializerOptions();
internal bool HttpClientsAdded { get; private set; }
/// <summary>
@ -24,8 +31,32 @@ namespace {{packageName}}.Client
/// <param name="services"></param>
public HostConfiguration(IServiceCollection services)
{
_services = services;{{#apiInfo}}{{#apis}}
services.AddSingleton<{{interfacePrefix}}{{classname}}, {{classname}}>();{{/apis}}{{/apiInfo}}
_services = services;
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new OpenAPIDateJsonConverter());
{{#models}}
{{#model}}
{{^isEnum}}
{{#allOf}}
{{#-first}}
_jsonOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/allOf}}
{{#anyOf}}
{{#-first}}
_jsonOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/anyOf}}
{{#oneOf}}
{{#-first}}
_jsonOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/oneOf}}
{{/isEnum}}
{{/model}}
{{/models}}
_services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions));{{#apiInfo}}{{#apis}}
_services.AddSingleton<{{interfacePrefix}}{{classname}}, {{classname}}>();{{/apis}}{{/apiInfo}}
}
/// <summary>
@ -61,34 +92,8 @@ namespace {{packageName}}.Client
/// <param name="client"></param>
/// <param name="builder"></param>
/// <returns></returns>
public HostConfiguration Add{{apiName}}HttpClients(
Action<HttpClient>{{nrt?}} client = null, Action<IHttpClientBuilder>{{nrt?}} builder = null)
public HostConfiguration Add{{apiName}}HttpClients(Action<HttpClient>{{nrt?}} client = null, Action<IHttpClientBuilder>{{nrt?}} builder = null)
{
ClientUtils.JsonSerializerOptions.Converters.Add(new OpenAPIDateJsonConverter());
{{#models}}
{{#model}}
{{^isEnum}}
{{#useGenericHost}}
{{#allOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/allOf}}
{{#anyOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/anyOf}}
{{#oneOf}}
{{#-first}}
ClientUtils.JsonSerializerOptions.Converters.Add(new {{classname}}JsonConverter());
{{/-first}}
{{/oneOf}}
{{/useGenericHost}}
{{/isEnum}}
{{/model}}
{{/models}}
Add{{apiName}}HttpClients<{{#apiInfo}}{{#apis}}{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>(client, builder);
return this;
@ -99,9 +104,9 @@ namespace {{packageName}}.Client
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public HostConfiguration ConfigureJsonOptions(Action<System.Text.Json.JsonSerializerOptions> options)
public HostConfiguration ConfigureJsonOptions(Action<JsonSerializerOptions> options)
{
options(Client.ClientUtils.JsonSerializerOptions);
options(_jsonOptions);
return this;
}

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Collections.Generic;
using System.IO;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Threading;

View File

@ -0,0 +1,29 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System.Text.Json;
namespace {{packageName}}.Client
{
/// <summary>
/// Provides the JsonSerializerOptions
/// </summary>
public class JsonSerializerOptionsProvider
{
/// <summary>
/// the JsonSerializerOptions
/// </summary>
public JsonSerializerOptions Options { get; }
/// <summary>
/// Instantiates a JsonSerializerOptionsProvider
/// </summary>
public JsonSerializerOptionsProvider(JsonSerializerOptions options)
{
Options = options;
}
}
}

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Threading;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;{{^netStandard}}
using System.Threading.Channels;{{/netStandard}}{{#netStandard}}
using System.Collections.Concurrent;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
namespace {{packageName}}.Client

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System.Linq;
using System.Collections.Generic;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Collections.Generic;

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Collections.Generic;
using System.Net;
@ -9,6 +11,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using {{packageName}}.Client;
{{#hasImport}}
using {{packageName}}.{{modelPackage}};
@ -62,9 +65,11 @@ namespace {{packageName}}.{{apiPackage}}
{{/allParams}}
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}object{{/returnType}}?&gt;</returns>
Task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}> {{operationId}}OrDefaultAsync({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{^required}}{{{dataType}}} {{paramName}} = null{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken? cancellationToken = null);{{/nrt}}{{^-last}}
Task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}> {{operationId}}OrDefaultAsync({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{^required}}{{{dataType}}} {{paramName}} = null{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#allParams.0}}, {{/allParams.0}}System.Threading.CancellationToken? cancellationToken = null);
{{/-last}}{{/operation}}
{{/nrt}}{{^-last}}
{{/-last}}
{{/operation}}
}
/// <summary>
@ -72,6 +77,8 @@ namespace {{packageName}}.{{apiPackage}}
/// </summary>
{{>visibility}} partial class {{classname}} : {{interfacePrefix}}{{classname}}
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -117,13 +124,14 @@ namespace {{packageName}}.{{apiPackage}}
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
/// </summary>
/// <returns></returns>
public {{classname}}(ILogger<{{classname}}> logger, HttpClient httpClient{{#hasApiKeyMethods}},
public {{classname}}(ILogger<{{classname}}> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider{{#hasApiKeyMethods}},
TokenProvider<ApiKeyToken> apiKeyProvider{{/hasApiKeyMethods}}{{#hasHttpBearerMethods}},
TokenProvider<BearerToken> bearerTokenProvider{{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}},
TokenProvider<BasicToken> basicTokenProvider{{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}},
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider{{/hasHttpSignatureMethods}}{{#hasOAuthMethods}},
TokenProvider<OAuthToken> oauthTokenProvider{{/hasOAuthMethods}})
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;{{#hasApiKeyMethods}}
ApiKeyProvider = apiKeyProvider;{{/hasApiKeyMethods}}{{#hasHttpBearerMethods}}
@ -153,8 +161,9 @@ namespace {{packageName}}.{{apiPackage}}
throw new ApiException(result.ReasonPhrase, result.StatusCode, result.RawContent);
return result.Content;
}{{#nrt}}
}
{{#nrt}}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
@ -178,7 +187,11 @@ namespace {{packageName}}.{{apiPackage}}
return result != null && result.IsSuccessStatusCode
? result.Content
: null;
}{{/nrt}}{{^nrt}}{{^returnTypeIsPrimitive}}
}
{{/nrt}}
{{^nrt}}
{{^returnTypeIsPrimitive}}
{{! Note that this method is a copy paste of above due to NRT complexities }}
/// <summary>
/// {{summary}} {{notes}}
@ -204,8 +217,9 @@ namespace {{packageName}}.{{apiPackage}}
? result.Content
: null;
}
{{/returnTypeIsPrimitive}}{{/nrt}}
{{/returnTypeIsPrimitive}}
{{/nrt}}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
@ -278,7 +292,7 @@ namespace {{packageName}}.{{apiPackage}}
request.Content = ({{paramName}} as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize({{paramName}}, ClientUtils.JsonSerializerOptions));{{/bodyParam}}{{#authMethods}}{{#-first}}
: request.Content = new StringContent(JsonSerializer.Serialize({{paramName}}, _jsonSerializerOptions));{{/bodyParam}}{{#authMethods}}{{#-first}}
List<TokenBase> tokens = new List<TokenBase>();{{/-first}}{{#isApiKey}}
@ -369,7 +383,7 @@ namespace {{packageName}}.{{apiPackage}}
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}> apiResponse = new ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}{{nrt?}}>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);{{#authMethods}}
apiResponse.Content = JsonSerializer.Deserialize<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}>(apiResponse.RawContent, _jsonSerializerOptions);{{#authMethods}}
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();{{/authMethods}}
@ -383,7 +397,8 @@ namespace {{packageName}}.{{apiPackage}}
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}{{^-last}}
{{/-last}}
{{/operation}}
}
{{/operations}}

View File

@ -1,7 +1,9 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}#nullable enable{{/nrt}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -107,6 +107,7 @@ src/Org.OpenAPITools/Client/HostConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningToken.cs
src/Org.OpenAPITools/Client/IApi.cs
src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs
src/Org.OpenAPITools/Client/OAuthToken.cs
src/Org.OpenAPITools/Client/OpenAPIDateJsonConverter.cs
src/Org.OpenAPITools/Client/RateLimitProvider`1.cs

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -61,13 +62,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ModelClient?&gt;</returns>
Task<ModelClient?> Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class AnotherFakeApi : IAnotherFakeApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -113,13 +117,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <returns></returns>
public AnotherFakeApi(ILogger<AnotherFakeApi> logger, HttpClient httpClient,
public AnotherFakeApi(ILogger<AnotherFakeApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -196,7 +201,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -241,7 +246,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -252,6 +257,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -58,13 +59,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;InlineResponseDefault?&gt;</returns>
Task<InlineResponseDefault?> FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class DefaultApi : IDefaultApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -110,13 +114,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <returns></returns>
public DefaultApi(ILogger<DefaultApi> logger, HttpClient httpClient,
public DefaultApi(ILogger<DefaultApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -215,7 +220,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<InlineResponseDefault?> apiResponse = new ApiResponse<InlineResponseDefault?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<InlineResponseDefault>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<InlineResponseDefault>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -226,6 +231,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -59,7 +60,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;HealthCheckResult?&gt;</returns>
Task<HealthCheckResult?> FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -94,7 +96,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;bool?&gt;</returns>
Task<bool?> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -129,7 +132,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;OuterComposite?&gt;</returns>
Task<OuterComposite?> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite? outerComposite = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -164,7 +168,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;decimal?&gt;</returns>
Task<decimal?> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -199,7 +204,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;string?&gt;</returns>
Task<string?> FakeOuterStringSerializeOrDefaultAsync(string? body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Array of Enums
/// </summary>
/// <remarks>
@ -231,7 +237,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;List&lt;OuterEnum&gt;?&gt;</returns>
Task<List<OuterEnum>?> GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -266,7 +273,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -304,7 +312,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// To test \&quot;client\&quot; model
/// </summary>
/// <remarks>
@ -339,7 +348,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;ModelClient?&gt;</returns>
Task<ModelClient?> TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
/// </summary>
/// <remarks>
@ -413,7 +423,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestEndpointParametersOrDefaultAsync(decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string? _string = null, System.IO.Stream? binary = null, DateTime? date = null, string? password = null, string? callback = null, DateTime? dateTime = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// To test enum parameters
/// </summary>
/// <remarks>
@ -469,7 +480,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestEnumParametersOrDefaultAsync(List<string>? enumHeaderStringArray = null, List<string>? enumQueryStringArray = null, int? enumQueryInteger = null, double? enumQueryDouble = null, string? enumHeaderString = null, string? enumQueryString = null, List<string>? enumFormStringArray = null, string? enumFormString = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Fake endpoint to test group parameters (optional)
/// </summary>
/// <remarks>
@ -519,7 +531,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestGroupParametersOrDefaultAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// test inline additionalProperties
/// </summary>
/// <remarks>
@ -554,7 +567,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary<string, string> requestBody, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// test json serialization of form data
/// </summary>
/// <remarks>
@ -592,7 +606,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -638,13 +653,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> TestQueryParameterCollectionFormatOrDefaultAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class FakeApi : IFakeApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -690,13 +708,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <returns></returns>
public FakeApi(ILogger<FakeApi> logger, HttpClient httpClient,
public FakeApi(ILogger<FakeApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -795,7 +814,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<HealthCheckResult?> apiResponse = new ApiResponse<HealthCheckResult?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<HealthCheckResult>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<HealthCheckResult>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -868,7 +887,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -913,7 +932,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<bool?> apiResponse = new ApiResponse<bool?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<bool>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<bool>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -986,7 +1005,7 @@ namespace Org.OpenAPITools.Api
request.Content = (outerComposite as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(outerComposite, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(outerComposite, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1031,7 +1050,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<OuterComposite?> apiResponse = new ApiResponse<OuterComposite?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<OuterComposite>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<OuterComposite>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1104,7 +1123,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1149,7 +1168,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<decimal?> apiResponse = new ApiResponse<decimal?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<decimal>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<decimal>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1222,7 +1241,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1267,7 +1286,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string?> apiResponse = new ApiResponse<string?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<string>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1369,7 +1388,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<OuterEnum>?> apiResponse = new ApiResponse<List<OuterEnum>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<OuterEnum>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<OuterEnum>>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1449,7 +1468,7 @@ namespace Org.OpenAPITools.Api
request.Content = (fileSchemaTestClass as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(fileSchemaTestClass, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1485,7 +1504,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1577,7 +1596,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1613,7 +1632,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1693,7 +1712,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1738,7 +1757,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1952,7 +1971,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -2116,7 +2135,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2266,7 +2285,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -2349,7 +2368,7 @@ namespace Org.OpenAPITools.Api
request.Content = (requestBody as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(requestBody, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -2385,7 +2404,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2515,7 +2534,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2652,7 +2671,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2663,6 +2682,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -61,13 +62,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ModelClient?&gt;</returns>
Task<ModelClient?> TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -113,13 +117,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <returns></returns>
public FakeClassnameTags123Api(ILogger<FakeClassnameTags123Api> logger, HttpClient httpClient,
public FakeClassnameTags123Api(ILogger<FakeClassnameTags123Api> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -198,7 +203,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -253,7 +258,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient?> apiResponse = new ApiResponse<ModelClient?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -267,6 +272,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -62,7 +63,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
@ -100,7 +102,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> DeletePetOrDefaultAsync(long petId, string? apiKey = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
@ -135,7 +138,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;List&lt;Pet&gt;?&gt;</returns>
Task<List<Pet>?> FindPetsByStatusOrDefaultAsync(List<string> status, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
@ -170,7 +174,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;List&lt;Pet&gt;?&gt;</returns>
Task<List<Pet>?> FindPetsByTagsOrDefaultAsync(List<string> tags, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
@ -205,7 +210,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;Pet?&gt;</returns>
Task<Pet?> GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Update an existing pet
/// </summary>
/// <remarks>
@ -240,7 +246,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
@ -281,7 +288,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> UpdatePetWithFormOrDefaultAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
@ -322,7 +330,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;ApiResponse?&gt;</returns>
Task<ApiResponse?> UploadFileOrDefaultAsync(long petId, string? additionalMetadata = null, System.IO.Stream? file = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
@ -362,13 +371,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ApiResponse?&gt;</returns>
Task<ApiResponse?> UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = null, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class PetApi : IPetApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -414,13 +426,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <returns></returns>
public PetApi(ILogger<PetApi> logger, HttpClient httpClient,
public PetApi(ILogger<PetApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -497,7 +510,7 @@ namespace Org.OpenAPITools.Api
request.Content = (pet as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -550,7 +563,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -674,7 +687,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -812,7 +825,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>?> apiResponse = new ApiResponse<List<Pet>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -953,7 +966,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>?> apiResponse = new ApiResponse<List<Pet>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1081,7 +1094,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Pet?> apiResponse = new ApiResponse<Pet?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Pet>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Pet>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1164,7 +1177,7 @@ namespace Org.OpenAPITools.Api
request.Content = (pet as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -1217,7 +1230,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1364,7 +1377,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1517,7 +1530,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse?> apiResponse = new ApiResponse<ApiResponse?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1672,7 +1685,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse?> apiResponse = new ApiResponse<ApiResponse?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1686,6 +1699,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -62,7 +63,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
@ -94,7 +96,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;Dictionary&lt;string, int&gt;?&gt;</returns>
Task<Dictionary<string, int>?> GetInventoryOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
@ -129,7 +132,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;Order?&gt;</returns>
Task<Order?> GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
@ -163,13 +167,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;Order?&gt;</returns>
Task<Order?> PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class StoreApi : IStoreApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -215,13 +222,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
public StoreApi(ILogger<StoreApi> logger, HttpClient httpClient,
public StoreApi(ILogger<StoreApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -322,7 +330,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -432,7 +440,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Dictionary<string, int>?> apiResponse = new ApiResponse<Dictionary<string, int>?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, int>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Dictionary<string, int>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -549,7 +557,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order?> apiResponse = new ApiResponse<Order?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Order>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -629,7 +637,7 @@ namespace Org.OpenAPITools.Api
request.Content = (order as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(order, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -675,7 +683,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order?> apiResponse = new ApiResponse<Order?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Order>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -686,6 +694,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -62,7 +63,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
@ -97,7 +99,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> CreateUsersWithArrayInputOrDefaultAsync(List<User> user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
@ -132,7 +135,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> CreateUsersWithListInputOrDefaultAsync(List<User> user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
@ -167,7 +171,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
@ -202,7 +207,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;User?&gt;</returns>
Task<User?> GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
@ -240,7 +246,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;string?&gt;</returns>
Task<string?> LoginUserOrDefaultAsync(string username, string password, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
@ -272,7 +279,8 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> LogoutUserOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
@ -309,13 +317,16 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object?&gt;</returns>
Task<object?> UpdateUserOrDefaultAsync(string username, User user, System.Threading.CancellationToken? cancellationToken = null);
}
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class UserApi : IUserApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -361,13 +372,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <returns></returns>
public UserApi(ILogger<UserApi> logger, HttpClient httpClient,
public UserApi(ILogger<UserApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -444,7 +456,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -480,7 +492,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -560,7 +572,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -596,7 +608,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -676,7 +688,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -712,7 +724,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -816,7 +828,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -930,7 +942,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<User?> apiResponse = new ApiResponse<User?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<User>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<User>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1056,7 +1068,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string?> apiResponse = new ApiResponse<string?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<string>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1149,7 +1161,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1236,7 +1248,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1272,7 +1284,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object?> apiResponse = new ApiResponse<object?>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1283,6 +1295,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -7,18 +7,20 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Polly.Timeout;
using Polly.Extensions.Http;
using Polly;
using System.Net.Http;
using Org.OpenAPITools.Api;
using KellermanSoftware.CompareNetObjects;
@ -59,11 +61,11 @@ namespace Org.OpenAPITools.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
public static bool TryDeserialize<T>(string json, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(json, options);
result = JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
catch (Exception)
@ -81,11 +83,11 @@ namespace Org.OpenAPITools.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(ref reader, options);
result = JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
@ -95,11 +97,6 @@ namespace Org.OpenAPITools.Client
}
}
/// <summary>
/// Json serializer options
/// </summary>
public static System.Text.Json.JsonSerializerOptions JsonSerializerOptions { get; set; } = new System.Text.Json.JsonSerializerOptions();
/// <summary>
/// Sanitize filename by removing the path
/// </summary>

View File

@ -7,10 +7,13 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using Org.OpenAPITools.Api;
@ -24,6 +27,8 @@ namespace Org.OpenAPITools.Client
public class HostConfiguration
{
private readonly IServiceCollection _services;
private JsonSerializerOptions _jsonOptions = new JsonSerializerOptions();
internal bool HttpClientsAdded { get; private set; }
/// <summary>
@ -33,13 +38,34 @@ namespace Org.OpenAPITools.Client
public HostConfiguration(IServiceCollection services)
{
_services = services;
services.AddSingleton<IAnotherFakeApi, AnotherFakeApi>();
services.AddSingleton<IDefaultApi, DefaultApi>();
services.AddSingleton<IFakeApi, FakeApi>();
services.AddSingleton<IFakeClassnameTags123Api, FakeClassnameTags123Api>();
services.AddSingleton<IPetApi, PetApi>();
services.AddSingleton<IStoreApi, StoreApi>();
services.AddSingleton<IUserApi, UserApi>();
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new OpenAPIDateJsonConverter());
_jsonOptions.Converters.Add(new CatJsonConverter());
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter());
_jsonOptions.Converters.Add(new FruitJsonConverter());
_jsonOptions.Converters.Add(new FruitReqJsonConverter());
_jsonOptions.Converters.Add(new GmFruitJsonConverter());
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
_jsonOptions.Converters.Add(new MammalJsonConverter());
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
_jsonOptions.Converters.Add(new PigJsonConverter());
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
_jsonOptions.Converters.Add(new ShapeJsonConverter());
_jsonOptions.Converters.Add(new ShapeOrNullJsonConverter());
_jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions));
_services.AddSingleton<IAnotherFakeApi, AnotherFakeApi>();
_services.AddSingleton<IDefaultApi, DefaultApi>();
_services.AddSingleton<IFakeApi, FakeApi>();
_services.AddSingleton<IFakeClassnameTags123Api, FakeClassnameTags123Api>();
_services.AddSingleton<IPetApi, PetApi>();
_services.AddSingleton<IStoreApi, StoreApi>();
_services.AddSingleton<IUserApi, UserApi>();
}
/// <summary>
@ -87,29 +113,8 @@ namespace Org.OpenAPITools.Client
/// <param name="client"></param>
/// <param name="builder"></param>
/// <returns></returns>
public HostConfiguration AddApiHttpClients(
Action<HttpClient>? client = null, Action<IHttpClientBuilder>? builder = null)
public HostConfiguration AddApiHttpClients(Action<HttpClient>? client = null, Action<IHttpClientBuilder>? builder = null)
{
ClientUtils.JsonSerializerOptions.Converters.Add(new OpenAPIDateJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new CatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ChildCatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new DogJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new EquilateralTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitReqJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new GmFruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new MammalJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new NullableShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new PigJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new QuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ScaleneTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeOrNullJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new SimpleQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new TriangleJsonConverter());
AddApiHttpClients<AnotherFakeApi, DefaultApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi>(client, builder);
return this;
@ -120,9 +125,9 @@ namespace Org.OpenAPITools.Client
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public HostConfiguration ConfigureJsonOptions(Action<System.Text.Json.JsonSerializerOptions> options)
public HostConfiguration ConfigureJsonOptions(Action<JsonSerializerOptions> options)
{
options(Client.ClientUtils.JsonSerializerOptions);
options(_jsonOptions);
return this;
}

View File

@ -0,0 +1,27 @@
// <auto-generated>
#nullable enable
using System.Text.Json;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Provides the JsonSerializerOptions
/// </summary>
public class JsonSerializerOptionsProvider
{
/// <summary>
/// the JsonSerializerOptions
/// </summary>
public JsonSerializerOptions Options { get; }
/// <summary>
/// Instantiates a JsonSerializerOptionsProvider
/// </summary>
public JsonSerializerOptionsProvider(JsonSerializerOptions options)
{
Options = options;
}
}
}

View File

@ -107,6 +107,7 @@ src/Org.OpenAPITools/Client/HostConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs
src/Org.OpenAPITools/Client/HttpSigningToken.cs
src/Org.OpenAPITools/Client/IApi.cs
src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs
src/Org.OpenAPITools/Client/OAuthToken.cs
src/Org.OpenAPITools/Client/OpenAPIDateJsonConverter.cs
src/Org.OpenAPITools/Client/RateLimitProvider`1.cs

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -49,14 +48,15 @@ namespace Org.OpenAPITools.Api
/// <param name="modelClient">client model</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ModelClient&gt;</returns>
Task<ModelClient> Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
}
Task<ModelClient> Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class AnotherFakeApi : IAnotherFakeApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -102,13 +102,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
/// </summary>
/// <returns></returns>
public AnotherFakeApi(ILogger<AnotherFakeApi> logger, HttpClient httpClient,
public AnotherFakeApi(ILogger<AnotherFakeApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -134,6 +135,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// To test special tags To test special tags and operation ID starting with number
/// </summary>
@ -156,7 +158,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// To test special tags To test special tags and operation ID starting with number
@ -185,7 +186,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -230,7 +231,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient> apiResponse = new ApiResponse<ModelClient>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -241,6 +242,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -47,14 +46,15 @@ namespace Org.OpenAPITools.Api
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;InlineResponseDefault&gt;</returns>
Task<InlineResponseDefault> FooGetAsync(System.Threading.CancellationToken? cancellationToken = null);
}
Task<InlineResponseDefault> FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class DefaultApi : IDefaultApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -100,13 +100,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="DefaultApi"/> class.
/// </summary>
/// <returns></returns>
public DefaultApi(ILogger<DefaultApi> logger, HttpClient httpClient,
public DefaultApi(ILogger<DefaultApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -131,6 +132,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
///
/// </summary>
@ -152,7 +154,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
///
@ -205,7 +206,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<InlineResponseDefault> apiResponse = new ApiResponse<InlineResponseDefault>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<InlineResponseDefault>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<InlineResponseDefault>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -216,6 +217,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -48,8 +47,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;HealthCheckResult&gt;</returns>
Task<HealthCheckResult> FakeHealthGetAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -72,8 +70,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;bool&gt;</returns>
Task<bool> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -96,8 +93,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;OuterComposite&gt;</returns>
Task<OuterComposite> FakeOuterCompositeSerializeAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -120,8 +116,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;decimal&gt;</returns>
Task<decimal> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -144,8 +139,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;string&gt;</returns>
Task<string> FakeOuterStringSerializeAsync(string body = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Array of Enums
/// </summary>
/// <remarks>
@ -166,8 +160,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;List&lt;OuterEnum&gt;&gt;</returns>
Task<List<OuterEnum>> GetArrayOfEnumsAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -190,8 +183,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -216,8 +208,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// To test \&quot;client\&quot; model
/// </summary>
/// <remarks>
@ -240,8 +231,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ModelClient&gt;</returns>
Task<ModelClient> TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
/// </summary>
/// <remarks>
@ -290,8 +280,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestEndpointParametersAsync(decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// To test enum parameters
/// </summary>
/// <remarks>
@ -328,8 +317,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestEnumParametersAsync(List<string> enumHeaderStringArray = null, List<string> enumQueryStringArray = null, int? enumQueryInteger = null, double? enumQueryDouble = null, string enumHeaderString = null, string enumQueryString = null, List<string> enumFormStringArray = null, string enumFormString = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Fake endpoint to test group parameters (optional)
/// </summary>
/// <remarks>
@ -362,8 +350,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// test inline additionalProperties
/// </summary>
/// <remarks>
@ -386,8 +373,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestInlineAdditionalPropertiesAsync(Dictionary<string, string> requestBody, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// test json serialization of form data
/// </summary>
/// <remarks>
@ -412,8 +398,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
///
/// </summary>
/// <remarks>
@ -443,14 +428,15 @@ namespace Org.OpenAPITools.Api
/// <param name="context"></param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken? cancellationToken = null);
}
Task<object> TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class FakeApi : IFakeApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -496,13 +482,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeApi"/> class.
/// </summary>
/// <returns></returns>
public FakeApi(ILogger<FakeApi> logger, HttpClient httpClient,
public FakeApi(ILogger<FakeApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -527,6 +514,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Health check endpoint
/// </summary>
@ -548,7 +536,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Health check endpoint
@ -601,7 +588,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<HealthCheckResult> apiResponse = new ApiResponse<HealthCheckResult>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<HealthCheckResult>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<HealthCheckResult>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -653,7 +640,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -698,7 +685,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<bool> apiResponse = new ApiResponse<bool>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<bool>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<bool>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -727,6 +714,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Test serialization of object with outer number type
/// </summary>
@ -749,7 +737,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Test serialization of object with outer number type
@ -771,7 +758,7 @@ namespace Org.OpenAPITools.Api
request.Content = (outerComposite as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(outerComposite, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(outerComposite, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -816,7 +803,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<OuterComposite> apiResponse = new ApiResponse<OuterComposite>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<OuterComposite>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<OuterComposite>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -868,7 +855,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -913,7 +900,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<decimal> apiResponse = new ApiResponse<decimal>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<decimal>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<decimal>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -965,7 +952,7 @@ namespace Org.OpenAPITools.Api
request.Content = (body as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1010,7 +997,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string> apiResponse = new ApiResponse<string>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<string>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1038,6 +1025,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Array of Enums
/// </summary>
@ -1059,7 +1047,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Array of Enums
@ -1112,7 +1099,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<OuterEnum>> apiResponse = new ApiResponse<List<OuterEnum>>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<OuterEnum>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<OuterEnum>>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1141,6 +1128,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </summary>
@ -1163,7 +1151,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
@ -1192,7 +1179,7 @@ namespace Org.OpenAPITools.Api
request.Content = (fileSchemaTestClass as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(fileSchemaTestClass, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1228,7 +1215,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1258,6 +1245,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
///
/// </summary>
@ -1281,7 +1269,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
///
@ -1320,7 +1307,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1356,7 +1343,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1385,6 +1372,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// To test \&quot;client\&quot; model To test \&quot;client\&quot; model
/// </summary>
@ -1407,7 +1395,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// To test \&quot;client\&quot; model To test \&quot;client\&quot; model
@ -1436,7 +1423,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1481,7 +1468,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient> apiResponse = new ApiResponse<ModelClient>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1523,6 +1510,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
/// </summary>
@ -1558,7 +1546,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -1689,7 +1676,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1728,6 +1715,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// To test enum parameters To test enum parameters
/// </summary>
@ -1757,7 +1745,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// To test enum parameters To test enum parameters
@ -1853,7 +1840,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1887,6 +1874,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional)
/// </summary>
@ -1914,7 +1902,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional)
@ -1994,7 +1981,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -2026,6 +2013,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// test inline additionalProperties
/// </summary>
@ -2048,7 +2036,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// test inline additionalProperties
@ -2077,7 +2064,7 @@ namespace Org.OpenAPITools.Api
request.Content = (requestBody as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(requestBody, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -2113,7 +2100,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2143,6 +2130,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// test json serialization of form data
/// </summary>
@ -2166,7 +2154,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// test json serialization of form data
@ -2243,7 +2230,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2276,6 +2263,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// To test the collection format in query parameters
/// </summary>
@ -2302,7 +2290,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// To test the collection format in query parameters
@ -2380,7 +2367,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -2391,6 +2378,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -49,14 +48,15 @@ namespace Org.OpenAPITools.Api
/// <param name="modelClient">client model</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ModelClient&gt;</returns>
Task<ModelClient> TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null);
}
Task<ModelClient> TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -102,13 +102,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
/// </summary>
/// <returns></returns>
public FakeClassnameTags123Api(ILogger<FakeClassnameTags123Api> logger, HttpClient httpClient,
public FakeClassnameTags123Api(ILogger<FakeClassnameTags123Api> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -134,6 +135,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// To test class name in snake case To test class name in snake case
/// </summary>
@ -156,7 +158,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// To test class name in snake case To test class name in snake case
@ -187,7 +188,7 @@ namespace Org.OpenAPITools.Api
request.Content = (modelClient as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -242,7 +243,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ModelClient> apiResponse = new ApiResponse<ModelClient>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -256,6 +257,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -50,8 +49,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> AddPetAsync(Pet pet, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
@ -76,8 +74,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
@ -100,8 +97,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;List&lt;Pet&gt;&gt;</returns>
Task<List<Pet>> FindPetsByStatusAsync(List<string> status, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
@ -124,8 +120,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;List&lt;Pet&gt;&gt;</returns>
Task<List<Pet>> FindPetsByTagsAsync(List<string> tags, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
@ -148,8 +143,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;Pet&gt;</returns>
Task<Pet> GetPetByIdAsync(long petId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Update an existing pet
/// </summary>
/// <remarks>
@ -172,8 +166,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> UpdatePetAsync(Pet pet, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
@ -200,8 +193,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
@ -228,8 +220,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ApiResponse&gt;</returns>
Task<ApiResponse> UploadFileAsync(long petId, string additionalMetadata = null, System.IO.Stream file = null, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
@ -255,14 +246,15 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;ApiResponse&gt;</returns>
Task<ApiResponse> UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string additionalMetadata = null, System.Threading.CancellationToken? cancellationToken = null);
}
Task<ApiResponse> UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string additionalMetadata = null, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class PetApi : IPetApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -308,13 +300,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <returns></returns>
public PetApi(ILogger<PetApi> logger, HttpClient httpClient,
public PetApi(ILogger<PetApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -340,6 +333,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Add a new pet to the store
/// </summary>
@ -362,7 +356,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Add a new pet to the store
@ -391,7 +384,7 @@ namespace Org.OpenAPITools.Api
request.Content = (pet as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -444,7 +437,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -480,6 +473,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Deletes a pet
/// </summary>
@ -503,7 +497,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Deletes a pet
@ -565,7 +558,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -597,6 +590,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
/// </summary>
@ -619,7 +613,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
@ -703,7 +696,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>> apiResponse = new ApiResponse<List<Pet>>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -738,6 +731,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
@ -760,7 +754,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -844,7 +837,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<List<Pet>> apiResponse = new ApiResponse<List<Pet>>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<List<Pet>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -879,6 +872,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
@ -901,7 +895,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Find pet by ID Returns a single pet
@ -969,7 +962,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Pet> apiResponse = new ApiResponse<Pet>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Pet>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Pet>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1001,6 +994,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Update an existing pet
/// </summary>
@ -1023,7 +1017,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Update an existing pet
@ -1052,7 +1045,7 @@ namespace Org.OpenAPITools.Api
request.Content = (pet as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(pet, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions));
List<TokenBase> tokens = new List<TokenBase>();
@ -1105,7 +1098,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1142,6 +1135,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
@ -1166,7 +1160,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Updates a pet in the store with form data
@ -1249,7 +1242,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1283,6 +1276,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// uploads an image
/// </summary>
@ -1307,7 +1301,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// uploads an image
@ -1399,7 +1392,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse> apiResponse = new ApiResponse<ApiResponse>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1433,6 +1426,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// uploads an image (required)
/// </summary>
@ -1457,7 +1451,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// uploads an image (required)
@ -1551,7 +1544,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<ApiResponse> apiResponse = new ApiResponse<ApiResponse>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<ApiResponse>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -1565,6 +1558,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -50,8 +49,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> DeleteOrderAsync(string orderId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
@ -72,8 +70,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;Dictionary&lt;string, int&gt;&gt;</returns>
Task<Dictionary<string, int>> GetInventoryAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
@ -96,8 +93,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;Order&gt;</returns>
Task<Order> GetOrderByIdAsync(long orderId, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
@ -119,14 +115,15 @@ namespace Org.OpenAPITools.Api
/// <param name="order">order placed for purchasing the pet</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;Order&gt;</returns>
Task<Order> PlaceOrderAsync(Order order, System.Threading.CancellationToken? cancellationToken = null);
}
Task<Order> PlaceOrderAsync(Order order, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class StoreApi : IStoreApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -172,13 +169,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
public StoreApi(ILogger<StoreApi> logger, HttpClient httpClient,
public StoreApi(ILogger<StoreApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -204,6 +202,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
@ -226,7 +225,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@ -279,7 +277,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -369,7 +367,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Dictionary<string, int>> apiResponse = new ApiResponse<Dictionary<string, int>>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, int>>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Dictionary<string, int>>(apiResponse.RawContent, _jsonSerializerOptions);
else if (apiResponse.StatusCode == (HttpStatusCode) 429)
foreach(TokenBase token in tokens)
token.BeginRateLimit();
@ -401,6 +399,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
/// </summary>
@ -423,7 +422,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -483,7 +481,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order> apiResponse = new ApiResponse<Order>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Order>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -512,6 +510,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Place an order for a pet
/// </summary>
@ -534,7 +533,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Place an order for a pet
@ -563,7 +561,7 @@ namespace Org.OpenAPITools.Api
request.Content = (order as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(order, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -609,7 +607,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<Order> apiResponse = new ApiResponse<Order>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<Order>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<Order>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -620,6 +618,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
@ -17,6 +15,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
@ -50,8 +49,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> CreateUserAsync(User user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
@ -74,8 +72,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> CreateUsersWithArrayInputAsync(List<User> user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
@ -98,8 +95,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> CreateUsersWithListInputAsync(List<User> user, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
@ -122,8 +118,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> DeleteUserAsync(string username, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
@ -146,8 +141,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;User&gt;</returns>
Task<User> GetUserByNameAsync(string username, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
@ -172,8 +166,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;string&gt;</returns>
Task<string> LoginUserAsync(string username, string password, System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
@ -194,8 +187,7 @@ namespace Org.OpenAPITools.Api
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> LogoutUserAsync(System.Threading.CancellationToken? cancellationToken = null);
/// <summary>
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
@ -219,14 +211,15 @@ namespace Org.OpenAPITools.Api
/// <param name="user">Updated user object</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse&lt;object&gt;</returns>
Task<object> UpdateUserAsync(string username, User user, System.Threading.CancellationToken? cancellationToken = null);
}
Task<object> UpdateUserAsync(string username, User user, System.Threading.CancellationToken? cancellationToken = null); }
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class UserApi : IUserApi
{
private JsonSerializerOptions _jsonSerializerOptions;
/// <summary>
/// An event to track the health of the server.
/// If you store these event args, be sure to purge old event args to prevent a memory leak.
@ -272,13 +265,14 @@ namespace Org.OpenAPITools.Api
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <returns></returns>
public UserApi(ILogger<UserApi> logger, HttpClient httpClient,
public UserApi(ILogger<UserApi> logger, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider,
TokenProvider<ApiKeyToken> apiKeyProvider,
TokenProvider<BearerToken> bearerTokenProvider,
TokenProvider<BasicToken> basicTokenProvider,
TokenProvider<HttpSignatureToken> httpSignatureTokenProvider,
TokenProvider<OAuthToken> oauthTokenProvider)
{
_jsonSerializerOptions = jsonSerializerOptionsProvider.Options;
Logger = logger;
HttpClient = httpClient;
ApiKeyProvider = apiKeyProvider;
@ -304,6 +298,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
@ -326,7 +321,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Create user This can only be done by the logged in user.
@ -355,7 +349,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -391,7 +385,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -420,6 +414,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -442,7 +437,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Creates list of users with given input array
@ -471,7 +465,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -507,7 +501,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -536,6 +530,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -558,7 +553,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Creates list of users with given input array
@ -587,7 +581,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -623,7 +617,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -652,6 +646,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
@ -674,7 +669,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Delete user This can only be done by the logged in user.
@ -727,7 +721,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -756,6 +750,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Get user by user name
/// </summary>
@ -778,7 +773,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Get user by user name
@ -841,7 +835,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<User> apiResponse = new ApiResponse<User>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<User>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<User>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -945,7 +939,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<string> apiResponse = new ApiResponse<string>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<string>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<string>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -973,6 +967,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
@ -994,7 +989,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Logs out current logged in user session
@ -1038,7 +1032,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1068,6 +1062,7 @@ namespace Org.OpenAPITools.Api
return result.Content;
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
@ -1091,7 +1086,6 @@ namespace Org.OpenAPITools.Api
? result.Content
: null;
}
/// <summary>
/// Updated user This can only be done by the logged in user.
@ -1125,7 +1119,7 @@ namespace Org.OpenAPITools.Api
request.Content = (user as object) is System.IO.Stream stream
? request.Content = new StreamContent(stream)
: request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(user, ClientUtils.JsonSerializerOptions));
: request.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions));
request.RequestUri = uriBuilder.Uri;
@ -1161,7 +1155,7 @@ namespace Org.OpenAPITools.Api
ApiResponse<object> apiResponse = new ApiResponse<object>(responseMessage, responseContent);
if (apiResponse.IsSuccessStatusCode)
apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize<object>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
apiResponse.Content = JsonSerializer.Deserialize<object>(apiResponse.RawContent, _jsonSerializerOptions);
return apiResponse;
}
@ -1172,6 +1166,5 @@ namespace Org.OpenAPITools.Api
Logger.LogError(e, "An error occured while sending the request to the server.");
throw;
}
}
}
} }
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
namespace Org.OpenAPITools.Client

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
namespace Org.OpenAPITools.Client

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
using System.Linq;
using System.Threading;

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
using System.Linq;
using System.Threading;

View File

@ -7,18 +7,18 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Polly.Timeout;
using Polly.Extensions.Http;
using Polly;
using System.Net.Http;
using Org.OpenAPITools.Api;
using KellermanSoftware.CompareNetObjects;
@ -59,11 +59,11 @@ namespace Org.OpenAPITools.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(string json, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result)
public static bool TryDeserialize<T>(string json, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(json, options);
result = JsonSerializer.Deserialize<T>(json, options);
return result != null;
}
catch (Exception)
@ -81,11 +81,11 @@ namespace Org.OpenAPITools.Client
/// <param name="options"></param>
/// <param name="result"></param>
/// <returns></returns>
public static bool TryDeserialize<T>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result)
public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOptions options, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result)
{
try
{
result = System.Text.Json.JsonSerializer.Deserialize<T>(ref reader, options);
result = JsonSerializer.Deserialize<T>(ref reader, options);
return result != null;
}
catch (Exception)
@ -95,11 +95,6 @@ namespace Org.OpenAPITools.Client
}
}
/// <summary>
/// Json serializer options
/// </summary>
public static System.Text.Json.JsonSerializerOptions JsonSerializerOptions { get; set; } = new System.Text.Json.JsonSerializerOptions();
/// <summary>
/// Sanitize filename by removing the path
/// </summary>

View File

@ -7,10 +7,11 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Net.Http;
using Microsoft.Extensions.DependencyInjection;
using Org.OpenAPITools.Api;
@ -24,6 +25,8 @@ namespace Org.OpenAPITools.Client
public class HostConfiguration
{
private readonly IServiceCollection _services;
private JsonSerializerOptions _jsonOptions = new JsonSerializerOptions();
internal bool HttpClientsAdded { get; private set; }
/// <summary>
@ -33,13 +36,34 @@ namespace Org.OpenAPITools.Client
public HostConfiguration(IServiceCollection services)
{
_services = services;
services.AddSingleton<IAnotherFakeApi, AnotherFakeApi>();
services.AddSingleton<IDefaultApi, DefaultApi>();
services.AddSingleton<IFakeApi, FakeApi>();
services.AddSingleton<IFakeClassnameTags123Api, FakeClassnameTags123Api>();
services.AddSingleton<IPetApi, PetApi>();
services.AddSingleton<IStoreApi, StoreApi>();
services.AddSingleton<IUserApi, UserApi>();
_jsonOptions.Converters.Add(new JsonStringEnumConverter());
_jsonOptions.Converters.Add(new OpenAPIDateJsonConverter());
_jsonOptions.Converters.Add(new CatJsonConverter());
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter());
_jsonOptions.Converters.Add(new FruitJsonConverter());
_jsonOptions.Converters.Add(new FruitReqJsonConverter());
_jsonOptions.Converters.Add(new GmFruitJsonConverter());
_jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
_jsonOptions.Converters.Add(new MammalJsonConverter());
_jsonOptions.Converters.Add(new NullableShapeJsonConverter());
_jsonOptions.Converters.Add(new PigJsonConverter());
_jsonOptions.Converters.Add(new QuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter());
_jsonOptions.Converters.Add(new ShapeJsonConverter());
_jsonOptions.Converters.Add(new ShapeOrNullJsonConverter());
_jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter());
_jsonOptions.Converters.Add(new TriangleJsonConverter());
_services.AddSingleton(new JsonSerializerOptionsProvider(_jsonOptions));
_services.AddSingleton<IAnotherFakeApi, AnotherFakeApi>();
_services.AddSingleton<IDefaultApi, DefaultApi>();
_services.AddSingleton<IFakeApi, FakeApi>();
_services.AddSingleton<IFakeClassnameTags123Api, FakeClassnameTags123Api>();
_services.AddSingleton<IPetApi, PetApi>();
_services.AddSingleton<IStoreApi, StoreApi>();
_services.AddSingleton<IUserApi, UserApi>();
}
/// <summary>
@ -87,29 +111,8 @@ namespace Org.OpenAPITools.Client
/// <param name="client"></param>
/// <param name="builder"></param>
/// <returns></returns>
public HostConfiguration AddApiHttpClients(
Action<HttpClient> client = null, Action<IHttpClientBuilder> builder = null)
public HostConfiguration AddApiHttpClients(Action<HttpClient> client = null, Action<IHttpClientBuilder> builder = null)
{
ClientUtils.JsonSerializerOptions.Converters.Add(new OpenAPIDateJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new CatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ChildCatJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new DogJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new EquilateralTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new FruitReqJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new GmFruitJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new IsoscelesTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new MammalJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new NullableShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new PigJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new QuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ScaleneTriangleJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new ShapeOrNullJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new SimpleQuadrilateralJsonConverter());
ClientUtils.JsonSerializerOptions.Converters.Add(new TriangleJsonConverter());
AddApiHttpClients<AnotherFakeApi, DefaultApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi>(client, builder);
return this;
@ -120,9 +123,9 @@ namespace Org.OpenAPITools.Client
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public HostConfiguration ConfigureJsonOptions(Action<System.Text.Json.JsonSerializerOptions> options)
public HostConfiguration ConfigureJsonOptions(Action<JsonSerializerOptions> options)
{
options(Client.ClientUtils.JsonSerializerOptions);
options(_jsonOptions);
return this;
}

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.IO;

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
using System.Linq;
using System.Threading;

View File

@ -0,0 +1,25 @@
// <auto-generated>
using System.Text.Json;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Provides the JsonSerializerOptions
/// </summary>
public class JsonSerializerOptionsProvider
{
/// <summary>
/// the JsonSerializerOptions
/// </summary>
public JsonSerializerOptions Options { get; }
/// <summary>
/// Instantiates a JsonSerializerOptionsProvider
/// </summary>
public JsonSerializerOptionsProvider(JsonSerializerOptions options)
{
Options = options;
}
}
}

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
using System.Linq;
using System.Threading;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Threading.Channels;

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System;
namespace Org.OpenAPITools.Client

View File

@ -1,7 +1,5 @@
// <auto-generated>
using System.Linq;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -8,8 +8,6 @@
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;

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