diff --git a/.github/workflows/samples-python-fastapi-server.yaml b/.github/workflows/samples-python-fastapi-server.yaml index d871693684f8..859da39128c1 100644 --- a/.github/workflows/samples-python-fastapi-server.yaml +++ b/.github/workflows/samples-python-fastapi-server.yaml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: - python-version: '3.9' + python-version: '3.10' - name: Install dependencies working-directory: ${{ matrix.sample }} run: | diff --git a/bin/configs/html.yaml b/bin/configs/html.yaml new file mode 100644 index 000000000000..5aab705f8dbb --- /dev/null +++ b/bin/configs/html.yaml @@ -0,0 +1,6 @@ +generatorName: html +outputDir: samples/documentation/html +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/htmlDocs +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/swift6-vapor.yaml b/bin/configs/swift6-vapor.yaml index 948e4c7429fd..ffba9e9cf466 100644 --- a/bin/configs/swift6-vapor.yaml +++ b/bin/configs/swift6-vapor.yaml @@ -7,6 +7,6 @@ generateAliasAsModel: true additionalProperties: projectName: PetstoreClient useSPMFileStructure: true - useClasses: true + useClasses: false useBacktickEscapes: true mapFileBinaryToData: true diff --git a/bitrise.yml b/bitrise.yml index 54ce23c6c534..b1ac197b4c76 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -27,15 +27,6 @@ workflows: set -e ./samples/client/petstore/swift6/swift6_test_all.sh - - script@1.2.0: - title: Run Swift5 tests - inputs: - - content: | - #!/usr/bin/env bash - - set -e - - ./samples/client/petstore/swift5/swift5_test_all.sh - script@1.2.0: title: Run swift-combine tests inputs: diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 269ceeaf6a6a..491b71df0e1b 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -488,7 +488,7 @@ org.assertj assertj-core - 3.23.1 + 3.27.7 test diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 9a6d64f09c96..5d8afcd07e70 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -1326,8 +1326,8 @@ public String toDefaultValue(CodegenProperty cp, Schema schema) { // if default to empty container option is set, respect the default values provided in the spec return toArrayDefaultValue(cp, schema); } else if (schema.getDefault() == null) { - // nullable or containerDefaultToNull set to true - if (cp.isNullable || containerDefaultToNull) { + // nullable or containerDefaultToNull set to true or an optional array with minItems > 0 + if (cp.isNullable || containerDefaultToNull || (cp.minItems != null && cp.minItems > 0 && !cp.getHasRequired())) { return null; } return getDefaultCollectionType(schema); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index 259916c0ebae..447e2b346666 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -214,7 +214,11 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List 1) { + phpReturnType = phpReturnType + "|null"; + } else { + phpReturnType = "?" + phpReturnType; + } docReturnType = docReturnType + "|null"; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java index b8044bd2219f..ba23e9df492d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java @@ -330,7 +330,7 @@ public void postProcess() { @Override public String generatorLanguageVersion() { - return "3.7"; + return "3.10"; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java index 289d9febe856..47c98f557411 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java @@ -235,7 +235,7 @@ private static URL getDefaultUrl() { public static boolean isRelativeUrl(List servers) { if (servers != null && servers.size() > 0) { final Server firstServer = servers.get(0); - return Pattern.matches("^(\\/[\\w\\d]+)+", firstServer.getUrl()); + return Pattern.matches("^(\\/[\\w\\d.~@-]+)+", firstServer.getUrl()); } return false; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index cf0422c3d9f4..44991f42e34a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -311,7 +311,7 @@ {{/useJakartaEe}} 2.9.10 1.0.0 - 3.23.1 + 3.27.7 5.10.2 diff --git a/modules/openapi-generator/src/main/resources/csharp/AssemblyInfo.mustache b/modules/openapi-generator/src/main/resources/csharp/AssemblyInfo.mustache index d5d937dc19fa..4f66e0398ed6 100644 --- a/modules/openapi-generator/src/main/resources/csharp/AssemblyInfo.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/AssemblyInfo.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiFactory.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiFactory.mustache index a445d2169219..d8aa27040ff1 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiFactory.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiFactory.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} using System; using Microsoft.Extensions.DependencyInjection; using {{packageName}}.{{apiPackage}}; diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiKeyToken.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiKeyToken.mustache index d3f1f5214886..ca9a9e36f136 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiKeyToken.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiKeyToken.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -53,4 +54,4 @@ namespace {{packageName}}.{{clientPackage}} parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(){{nrt!}}; } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponseEventArgs`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponseEventArgs`1.mustache index aea35fae13aa..e50a15c7c9f4 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponseEventArgs`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponseEventArgs`1.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} using System; namespace {{packageName}}.{{clientPackage}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BasicToken.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BasicToken.mustache index ed6f53e548ea..c35e95b44f9a 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BasicToken.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BasicToken.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -43,4 +44,4 @@ namespace {{packageName}}.{{clientPackage}} request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", {{packageName}}.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BearerToken.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BearerToken.mustache index 761f598d82be..de33b602ad34 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BearerToken.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/BearerToken.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -38,4 +39,4 @@ namespace {{packageName}}.{{clientPackage}} request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/CookieContainer.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/CookieContainer.mustache index f96d4fb418fa..3b7c10b75427 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/CookieContainer.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/CookieContainer.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -19,4 +20,4 @@ namespace {{packageName}}.{{clientPackage}} /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache index b74fcfa0a1de..aa0937189a21 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} using System; namespace {{packageName}}.{{clientPackage}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache index 03dd95e59a51..3e481c4d005b 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache @@ -98,7 +98,7 @@ namespace {{packageName}}.{{clientPackage}} List builders = new List(); - {{#apiInfo}}{{#apis}}builders.Add(_services.AddHttpClient<{{interfacePrefix}}{{classname}}, {{classname}}>(client)); + {{#apiInfo}}{{#apis}}builders.Add(_services.AddHttpClient<{{interfacePrefix}}{{classname}}, {{classname}}>("{{packageName}}.{{apiPackage}}.{{interfacePrefix}}{{classname}}", client)); {{/apis}}{{/apiInfo}} if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningToken.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningToken.mustache index 881682e89241..e07345d2d046 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningToken.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningToken.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -42,4 +43,4 @@ namespace {{packageName}}.{{clientPackage}} request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/IApi.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/IApi.mustache index af31cffe9293..a3524bac5bb6 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/IApi.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/IApi.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} using System.Net.Http; namespace {{packageName}}.{{apiPackage}} @@ -12,4 +13,4 @@ namespace {{packageName}}.{{apiPackage}} /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonSerializerOptionsProvider.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonSerializerOptionsProvider.mustache index 93f8054031b8..2f74d33672e5 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonSerializerOptionsProvider.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonSerializerOptionsProvider.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -26,4 +27,4 @@ namespace {{packageName}}.{{clientPackage}} Options = options; } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OAuthToken.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OAuthToken.mustache index 23b3cab91966..26ee25490c90 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OAuthToken.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OAuthToken.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -38,4 +39,4 @@ namespace {{packageName}}.{{clientPackage}} request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache index a787cfd640db..2e74e493fce2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache @@ -16,7 +16,11 @@ namespace {{packageName}}.{{clientPackage}} /// {{>visibility}} class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary>{{/net70OrLater}}(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary>{{/net70OrLater}}(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -85,7 +89,7 @@ namespace {{packageName}}.{{clientPackage}} } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}}) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}}) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel{{nrt?}} tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache index d4d520e67c1d..2597d12ef238 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -17,11 +18,18 @@ namespace {{packageName}}.{{clientPackage}} private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler{{nrt?}} TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler{{nrt?}} TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -35,7 +43,6 @@ namespace {{packageName}}.{{clientPackage}} StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -70,4 +77,4 @@ namespace {{packageName}}.{{clientPackage}} TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenContainer`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenContainer`1.mustache index 24c84a551f53..3c3546f68761 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenContainer`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenContainer`1.mustache @@ -1,5 +1,6 @@ // -{{partial_header}} +{{>partial_header}} + {{#nrt}} #nullable enable @@ -36,4 +37,4 @@ namespace {{packageName}}.{{clientPackage}} Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenProvider`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenProvider`1.mustache index 21dc823e64f5..55743224c4fa 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenProvider`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenProvider`1.mustache @@ -16,6 +16,12 @@ namespace {{packageName}} /// {{>visibility}} abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}}); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}}); } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/htmlDocs/bodyParam.mustache b/modules/openapi-generator/src/main/resources/htmlDocs/bodyParam.mustache index 1c3e14a80905..bad72b4f4756 100644 --- a/modules/openapi-generator/src/main/resources/htmlDocs/bodyParam.mustache +++ b/modules/openapi-generator/src/main/resources/htmlDocs/bodyParam.mustache @@ -1,3 +1,3 @@ -{{#isBodyParam}}
{{baseName}} {{#baseType}}{{baseType}}{{/baseType}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isBodyParam}}
{{baseName}} {{#isContainer}}{{containerType}}[{{/isContainer}}{{#baseType}}{{baseType}}{{/baseType}}{{#isContainer}}]{{/isContainer}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
Body Parameter — {{unescapedDescription}} {{#defaultValue}}default: {{{.}}}{{/defaultValue}}
{{/isBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache index a71e60352a38..8e0fe46861eb 100644 --- a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache @@ -22,7 +22,7 @@ orjson==3.9.15 promise==2.3 pydantic>=2 python-dotenv==0.17.1 -python-multipart==0.0.18 +python-multipart==0.0.22 PyYAML>=5.4.1,<6.1.0 requests==2.32.4 Rx==1.6.1 diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache index 05846b4f1def..16b981bedef9 100644 --- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache @@ -66,22 +66,22 @@ secrecy = "0.8.0" {{/withAWSV4Signature}} {{#reqwest}} {{^supportAsync}} -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } {{#supportMiddleware}} -reqwest-middleware = { version = "^0.4", features = ["json", "blocking", "multipart"] } +reqwest-middleware = { version = "^0.5", features = ["json", "multipart", "query", "form"] } {{/supportMiddleware}} {{/supportAsync}} {{#supportAsync}} {{#useAsyncFileStream}} tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } {{/useAsyncFileStream}} {{^useAsyncFileStream}} -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] } {{/useAsyncFileStream}} {{#supportMiddleware}} -reqwest-middleware = { version = "^0.4", features = ["json", "multipart"] } +reqwest-middleware = { version = "^0.5", features = ["json", "multipart", "query", "form"] } {{/supportMiddleware}} {{#supportTokenSource}} async-trait = "^0.1" @@ -93,13 +93,13 @@ google-cloud-token = "^0.1" [features] default = [{{#reqwestDefaultFeatures}}"{{.}}"{{^-last}}, {{/-last}}{{/reqwestDefaultFeatures}}] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] {{/reqwest}} {{#reqwestTrait}} async-trait = "^0.1" -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } {{#supportMiddleware}} -reqwest-middleware = { version = "^0.4", features = ["json", "multipart"] } +reqwest-middleware = { version = "^0.5", features = ["json", "multipart", "query", "form"] } {{/supportMiddleware}} {{#supportTokenSource}} # TODO: propose to Yoshidan to externalize this as non google related crate, so that it can easily be extended for other cloud providers. @@ -114,7 +114,7 @@ bon = { version = "2.3", optional = true } [features] default = [{{#reqwestDefaultFeatures}}"{{.}}"{{^-last}}, {{/-last}}{{/reqwestDefaultFeatures}}] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] {{#mockall}} mockall = ["dep:mockall"] {{/mockall}} diff --git a/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache b/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache index 04c8f841528b..f25c30b2ae6b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache @@ -7,7 +7,7 @@ import Foundation{{#useVapor}} import Vapor{{/useVapor}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper: Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache index c9d2a508d099..78b13a080998 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache @@ -19,8 +19,8 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var basePath: String{{#useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var customHeaders: HTTPHeaders {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiClient: Vapor.Client? - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiWrapper: (inout Vapor.ClientRequest) throws -> () - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var contentConfiguration{{/useVapor}}{{^useVapor}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiWrapper: @Sendable (inout Vapor.ClientRequest) throws -> () + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var contentConfiguration: ContentConfiguration{{/useVapor}}{{^useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var customHeaders: [String: String] {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var requestBuilderFactory: RequestBuilderFactory @@ -49,8 +49,8 @@ import Alamofire{{/useAlamofire}} basePath: String = "{{{basePath}}}",{{#useVapor}} customHeaders: HTTPHeaders = [:], apiClient: Vapor.Client? = nil, - apiWrapper: (inout Vapor.ClientRequest) throws -> () = { _ in }, - contentConfiguration = ContentConfiguration.default(){{/useVapor}}{{^useVapor}} + apiWrapper: @escaping @Sendable (inout Vapor.ClientRequest) throws -> () = { _ in }, + contentConfiguration: ContentConfiguration = ContentConfiguration.default(){{/useVapor}}{{^useVapor}} customHeaders: [String: String] = [:], credential: URLCredential? = nil, requestBuilderFactory: RequestBuilderFactory = {{#useAlamofire}}AlamofireRequestBuilderFactory(){{/useAlamofire}}{{#useURLSession}}URLSessionRequestBuilderFactory(){{/useURLSession}}, @@ -63,10 +63,10 @@ import Alamofire{{/useAlamofire}} stringResponseSerializer: AnyResponseSerializer = AnyResponseSerializer(StringResponseSerializer()){{/useAlamofire}}{{/useVapor}} ) { self.basePath = basePath{{#useVapor}} - customHeaders = customHeaders - apiClient = apiClient - apiWrapper = apiWrapper - contentConfiguration = contentConfiguration{{/useVapor}}{{^useVapor}} + self.customHeaders = customHeaders + self.apiClient = apiClient + self.apiWrapper = apiWrapper + self.contentConfiguration = contentConfiguration{{/useVapor}}{{^useVapor}} self.customHeaders = customHeaders self.credential = credential self.requestBuilderFactory = requestBuilderFactory @@ -82,7 +82,7 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = {{projectName}}APIConfiguration() }{{^useVapor}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder: @unchecked Sendable, Identifiable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder: @unchecked Sendable, Identifiable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var headers: [String: String] {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: any Sendable]? @@ -119,9 +119,21 @@ import Alamofire{{/useAlamofire}} } {{#useAsyncAwait}} - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + #if compiler(>=6.2) + @concurrent + @discardableResult + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else @discardableResult {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -135,7 +147,6 @@ import Alamofire{{/useAlamofire}} self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -153,7 +164,7 @@ import Alamofire{{/useAlamofire}} } } } - + {{/useAsyncAwait}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self { if !value.isEmpty { @@ -167,7 +178,7 @@ import Alamofire{{/useAlamofire}} } } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type }{{/useVapor}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache index b009950d7123..0a3670cca2c2 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache @@ -236,13 +236,11 @@ extension RequestBuilder { } }{{/usePromiseKit}}{{#useVapor}} -extension UUID: Content { } +extension UUID: @retroactive Content { } -extension URL: Content { } +extension URL: @retroactive Content { } -extension Bool: Content { } - -extension Set: ResponseEncodable where Element: Content { +extension Set: @retroactive ResponseEncodable where Element: Content { public func encodeResponse(for request: Vapor.Request) -> EventLoopFuture { let response = Vapor.Response() do { @@ -254,7 +252,15 @@ extension Set: ResponseEncodable where Element: Content { } } -extension Set: RequestDecodable where Element: Content { +extension Set: @retroactive AsyncResponseEncodable where Element: Content { + public func encodeResponse(for request: Vapor.Request) async throws -> Vapor.Response { + let response = Vapor.Response() + try response.content.encode(Array(self)) + return response + } +} + +extension Set: @retroactive RequestDecodable where Element: Content { public static func decodeRequest(_ request: Vapor.Request) -> EventLoopFuture { do { let content = try request.content.decode([Element].self) @@ -265,6 +271,13 @@ extension Set: RequestDecodable where Element: Content { } } -extension Set: Content where Element: Content { } +extension Set: @retroactive AsyncRequestDecodable where Element: Content { + public static func decodeRequest(_ request: Vapor.Request) async throws -> Self { + let content = try request.content.decode([Element].self) + return Set(content) + } +} + +extension Set: @retroactive Content where Element: Content { } extension JSONValue: Content {}{{/useVapor}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Models.mustache b/modules/openapi-generator/src/main/resources/swift6/Models.mustache index c8a80a636fb7..0a1f951e7682 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Models.mustache @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ extension NullEncodable: Codable where Wrapped: Codable { case requestMissingURL } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DecodableRequestBuilderError: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache b/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache index 000f495b48f0..ff8219f3a85e 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache @@ -9,10 +9,10 @@ let package = Package( .macOS(.v10_15), {{/useVapor}} {{^useVapor}} - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), {{/useVapor}} ], products: [ @@ -34,7 +34,7 @@ let package = Package( .package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.8.0")), {{/useRxSwift}} {{#useVapor}} - .package(url: "https://github.com/vapor/vapor", from: "4.0.0") + .package(url: "https://github.com/vapor/vapor", from: "4.99.0"), {{/useVapor}} ], targets: [ @@ -42,7 +42,7 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "{{projectName}}", - dependencies: [{{#useVapor}}"Vapor", {{/useVapor}}{{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], + dependencies: [{{#useVapor}}.product(name: "Vapor", package: "vapor"){{/useVapor}}{{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], path: "{{swiftPackagePath}}{{^swiftPackagePath}}{{#useSPMFileStructure}}Sources/{{projectName}}{{/useSPMFileStructure}}{{^useSPMFileStructure}}{{projectName}}/Classes{{/useSPMFileStructure}}{{/swiftPackagePath}}" ), ], diff --git a/modules/openapi-generator/src/main/resources/swift6/Podspec.mustache b/modules/openapi-generator/src/main/resources/swift6/Podspec.mustache index fc7ff92f285e..70b97e74c950 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Podspec.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Podspec.mustache @@ -1,10 +1,10 @@ Pod::Spec.new do |s| s.name = '{{projectName}}'{{#projectDescription}} s.summary = '{{.}}'{{/projectDescription}} - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '{{podVersion}}{{^podVersion}}{{#apiInfo}}{{version}}{{/apiInfo}}{{^apiInfo}}}0.0.1{{/apiInfo}}{{/podVersion}}' s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v{{#apiInfo}}{{version}}{{/apiInfo}}{{^apiInfo}}}0.0.1{{/apiInfo}}' }{{/podSource}} {{#podAuthors}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache index 9d60c6098f13..adfb876f001b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache @@ -27,23 +27,23 @@ extension NumericRule: Sendable where T: Sendable {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var uniqueItems: Bool } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum StringValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NumericValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ArrayValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ValidationError: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ValidationError: Error, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} fileprivate(set) var kinds: Set } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct Validator { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/modules/openapi-generator/src/main/resources/swift6/api.mustache b/modules/openapi-generator/src/main/resources/swift6/api.mustache index 8242210a5a15..2180f72bda6d 100644 --- a/modules/openapi-generator/src/main/resources/swift6/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/api.mustache @@ -8,9 +8,7 @@ import Foundation{{#usePromiseKit}} @preconcurrency import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} @preconcurrency import RxSwift{{/useRxSwift}}{{#useCombine}} -#if canImport(Combine) -import Combine -#endif{{/useCombine}}{{#useVapor}} +import Combine{{/useCombine}}{{#useVapor}} import Vapor{{/useVapor}}{{#swiftUseApiNamespace}} extension {{projectName}}API { @@ -161,11 +159,9 @@ extension {{projectName}}API { - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - returns: AnyPublisher<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> */ - #if canImport(Combine) {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared{{/apiStaticMethod}}) -> AnyPublisher<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { let requestBuilder = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}) let requestTask = requestBuilder.requestTask @@ -195,7 +191,6 @@ extension {{projectName}}API { .eraseToAnyPublisher() {{/combineDeferred}} } - #endif {{/useCombine}} {{#useAsyncAwait}} @@ -210,7 +205,6 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared{{/apiStaticMethod}}) async throws(ErrorResponse){{#returnType}} -> {{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{/returnType}} { return try await {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}).execute().body } @@ -357,19 +351,19 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}Raw({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}APIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}Raw({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders? = nil, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{#-first}}var{{/-first}}{{/pathParams}} localVariablePath = "{{{path}}}"{{#pathParams}} let {{paramName}}PreEscape = String(describing: {{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}{{paramName}}{{/isEnum}}) let {{paramName}}PostEscape = {{paramName}}PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{paramName}}PostEscape, options: .literal, range: nil){{/pathParams}} let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}apiConfiguration.apiClient else { + guard let localVariableApiClient = apiConfiguration.apiClient else { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.{{httpMethod}}, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.{{httpMethod}}, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) {{#hasHeaderParams}}{{#headerParams}} localVariableRequest.headers.add(name: "{{baseName}}", value: {{#isArray}}{{paramName}}{{^required}}?{{/required}}.map { $0{{#isEnum}}.rawValue{{/isEnum}}.description }.description{{/isArray}}{{^isArray}}{{#isEnum}}{{paramName}}{{^required}}?{{/required}}.rawValue.description{{/isEnum}}{{^isEnum}}{{paramName}}{{^required}}?{{/required}}.description{{/isEnum}}{{/isArray}}{{^required}} ?? ""{{/required}}) {{/headerParams}}{{/hasHeaderParams}} @@ -437,8 +431,8 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}APIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { - return {{operationId}}Raw({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} in + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders? = nil, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { + return {{operationId}}Raw({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} in switch response.status.code { {{#responses}} {{#isDefault}}default{{/isDefault}}{{^isDefault}}case {{code}}{{/isDefault}}: diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache index f2db4445678a..a92eb8c13add 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache @@ -7,7 +7,7 @@ import Foundation import Alamofire -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class AlamofireRequestBuilderFactory: RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache index 7f97dbdd755c..59b4aecbedd2 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class URLSessionRequestBuilderFactory: RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ extension JSONDataEncoding: ParameterEncoding {} case dontRetry } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol OpenAPIInterceptor { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/modules/openapi-generator/src/main/resources/swift6/model.mustache b/modules/openapi-generator/src/main/resources/swift6/model.mustache index e9d561310dc8..8f3127a0bdaf 100644 --- a/modules/openapi-generator/src/main/resources/swift6/model.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/model.mustache @@ -25,6 +25,5 @@ extension {{projectName}}API { {{#swiftUseApiNamespace}} } {{/swiftUseApiNamespace}}{{#models}}{{#model}}{{#vendorExtensions.x-swift-identifiable}} -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}{{{classname}}}: Identifiable {} {{/vendorExtensions.x-swift-identifiable}}{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache index d577636875ba..c1e562c6ca11 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache @@ -1,5 +1,5 @@ {{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { -{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable { +{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class {{classname}}: NSObject, Codable, @unchecked Sendable { {{/objcCompatible}} {{#allVars}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache index 3182d6027e33..4f035d5a5d27 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface {{configurationParametersInterfaceName}} { /** @@ -198,7 +199,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 5c99230c73f0..1e8db2b3c4c3 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -42,6 +42,19 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn */ export interface {{classname}}Interface { {{#operation}} + /** + * Creates request options for {{nickname}} without sending the request + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + * @throws {RequiredError} + * @memberof {{classname}}Interface + */ + {{nickname}}RequestOpts({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise; + /** * {{¬es}} {{#summary}} @@ -95,17 +108,12 @@ export class {{classname}} extends runtime.BaseAPI { {{#operation}} /** - {{#notes}} - * {{¬es}} - {{/notes}} - {{#summary}} - * {{&summary}} - {{/summary}} + * Creates request options for {{nickname}} without sending the request {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async {{nickname}}RequestOpts({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise { {{#allParams}} {{#required}} if (requestParameters['{{paramName}}'] == null) { @@ -304,7 +312,7 @@ export class {{classname}} extends runtime.BaseAPI { {{/isDateTimeType}} {{/pathParams}} - const response = await this.request({ + return { path: urlPath, method: '{{httpMethod}}', headers: headerParameters, @@ -337,7 +345,23 @@ export class {{classname}} extends runtime.BaseAPI { {{#hasFormParams}} body: formParams, {{/hasFormParams}} - }, initOverrides); + }; + } + + /** + {{#notes}} + * {{¬es}} + {{/notes}} + {{#summary}} + * {{&summary}} + {{/summary}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.{{nickname}}RequestOpts({{#allParams.0}}requestParameters{{/allParams.0}}); + const response = await this.request(requestOptions, initOverrides); {{#returnType}} {{#isResponseFile}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 440022a3e668..12f3471ed7a5 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -216,6 +216,11 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise<{{{fileContentDataType}}}>; + {{#platforms}} + {{#node}} + stream(): ReadableStream | null; + {{/node}} + {{/platforms}} } /** @@ -253,6 +258,14 @@ export class SelfDecodingBody implements ResponseBody { {{/deno}} {{/platforms}} } + + {{#platforms}} + {{#node}} + stream(): ReadableStream | null { + return null; + } + {{/node}} + {{/platforms}} } export class ResponseContext { diff --git a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache index a4f779b937c4..f9e38334e3e9 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache @@ -38,7 +38,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { {{#node}} const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; {{/node}} {{^node}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index 92fab8b73d95..1ba9a2c7c5c6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -671,6 +671,32 @@ public void testHandlesTrailingSlashInServers() { Assert.assertEquals(servers.get(2).url, "http://notrailingslash.io:80/v2"); } + @Test + public void testHandlesRelativeUrlsWithSpecialChars() { + final Map specToBasePath = Map.of( + "src/test/resources/3_0/relative-url-point.yaml", "/api/v4.0", + "src/test/resources/3_0/relative-url-dash.yaml", "/api-v3", + "src/test/resources/3_0/relative-url-tilde.yaml", "/~api/v5", + "src/test/resources/3_0/relative-url-at.yaml", "/api/@6" + ); + + specToBasePath.forEach((spec, expectedBasePath) -> { + OpenAPI openAPI = TestUtils.parseFlattenSpec(spec); + ClientOptInput opts = new ClientOptInput(); + opts.openAPI(openAPI); + DefaultCodegen config = new DefaultCodegen(); + config.setStrictSpecBehavior(false); + opts.config(config); + final DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + generator.configureGeneratorProperties(); + + Map bundle = generator.buildSupportFileBundle(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); + final String actualBasePath = (String) bundle.get("basePath"); + Assert.assertEquals(actualBasePath, expectedBasePath); + }); + } + @Test public void testHandlesRelativeUrlsInServers() { OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_10056.yaml"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 11ca74f3e534..39d573ea219b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -1590,7 +1590,6 @@ public void shouldGenerateDefaultValueForEnumRequestParameter() throws IOExcepti assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/GetApi.java"), "@RequestParam(value = \"testParameter1\", required = false, defaultValue = \"BAR\")", "@RequestParam(value = \"TestParameter2\", required = false, defaultValue = \"BAR\")"); - } /** @@ -5075,7 +5074,36 @@ public void optionalListShouldBeEmpty() throws IOException { JavaFileAssert.assertThat(files.get("PetDto.java")) .fileContains("private List<@Valid TagDto> tags = new ArrayList<>();") .fileContains("private List photoUrls = new ArrayList<>();"); + } + + @Test + public void testOptionalListWithMinItems1ShouldBeNull_issue_22784() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_1/issue_22784.yaml", null, new ParseOptions()).getOpenAPI(); + SpringCodegen codegen = new SpringCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(INTERFACE_ONLY, "true"); + codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.model"); + codegen.additionalProperties().put(CodegenConstants.API_NAME_SUFFIX, "Controller"); + codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller"); + codegen.additionalProperties().put(CodegenConstants.MODEL_NAME_SUFFIX, "Dto"); + + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + generator.setGenerateMetadata(false); // skip metadata and ↓ only generate models + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); + + Map files = generator.opts(input).generate().stream() + .collect(Collectors.toMap(File::getName, Function.identity())); + JavaFileAssert.assertThat(files.get("FooBarRequestDto.java")) + .fileContains("private @Nullable List<@Valid BarDto> barList;"); } @Test diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java index 68e9dc11ed1f..02f58f48f64e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpNextgenClientCodegenTest.java @@ -29,6 +29,7 @@ import org.testng.annotations.Test; import java.io.File; +import java.io.IOException; import java.nio.file.Files; import java.util.List; import java.util.Map; @@ -146,4 +147,33 @@ public void testEnumUnknownDefaultCaseDeserializationDisabled() throws Exception Assert.assertListNotContains(modelContent, a -> a.equals("$color = self::COLOR_UNKNOWN_DEFAULT_OPEN_API;"), ""); Assert.assertListContains(modelContent, a -> a.equalsIgnoreCase("\"Invalid value '%s' for 'color', must be one of '%s'\","), ""); } + + @Test + public void testDifferentResponseSchemasWithEmpty() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/bugs/issue_22817.yaml", null, new ParseOptions()) + .getOpenAPI(); + + + codegen.setOutputDir(output.getAbsolutePath()); + ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + Map files = generator.opts(input).generate().stream() + .collect(Collectors.toMap(File::getName, Function.identity())); + + List modelContent = Files + .readAllLines(files.get("DefaultApi.php").toPath()) + .stream() + .map(String::trim) + .collect(Collectors.toList()); + + Assert.assertListContains(modelContent, a -> a.equals("): int|string|null"), "Expected to find nullable return type declaration."); + Assert.assertListNotContains(modelContent, a -> a.equals("): ?int|string"), "Expected to not find invalid union type with '?'."); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/relative-url-at.yaml b/modules/openapi-generator/src/test/resources/3_0/relative-url-at.yaml new file mode 100644 index 000000000000..8dbe70ba081b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/relative-url-at.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: OpenAPI Petstore + description: "sample spec" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 1.0.0 +servers: + - url: /api/@6 +tags: [] +paths: {} +components: + schemas: {} + securitySchemes: {} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/relative-url-dash.yaml b/modules/openapi-generator/src/test/resources/3_0/relative-url-dash.yaml new file mode 100644 index 000000000000..6295b3f3fd9f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/relative-url-dash.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: OpenAPI Petstore + description: "sample spec" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 1.0.0 +servers: + - url: /api-v3 +tags: [] +paths: {} +components: + schemas: {} + securitySchemes: {} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/relative-url-point.yaml b/modules/openapi-generator/src/test/resources/3_0/relative-url-point.yaml new file mode 100644 index 000000000000..35db6758ad6e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/relative-url-point.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: OpenAPI Petstore + description: "sample spec" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 1.0.0 +servers: + - url: /api/v4.0 +tags: [] +paths: {} +components: + schemas: {} + securitySchemes: {} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/relative-url-tilde.yaml b/modules/openapi-generator/src/test/resources/3_0/relative-url-tilde.yaml new file mode 100644 index 000000000000..376700a3d64c --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/relative-url-tilde.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: OpenAPI Petstore + description: "sample spec" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 1.0.0 +servers: + - url: /~api/v5 +tags: [] +paths: {} +components: + schemas: {} + securitySchemes: {} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_1/issue_22784.yaml b/modules/openapi-generator/src/test/resources/3_1/issue_22784.yaml new file mode 100644 index 000000000000..046b4c314fbd --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/issue_22784.yaml @@ -0,0 +1,45 @@ +openapi: 3.1.1 +info: + title: Optional Array with minItems 1 OpenAPI Example + version: 1.0.0 +paths: + /foo-bar: + put: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/FooBarRequest' + responses: + 204: + description: success + +components: + schemas: + FooBarRequest: + type: object + properties: + foo: + properties: + name: + type: string + required: + - name + barList: + description: | + This array is optional. If provided, it must contain between 1 and 3 items + type: array + items: + $ref: '#/components/schemas/Bar' + minItems: 1 + maxItems: 3 + required: + - foo + Bar: + type: object + properties: + someProperty: + type: string + required: + - someProperty diff --git a/modules/openapi-generator/src/test/resources/bugs/issue_22817.yaml b/modules/openapi-generator/src/test/resources/bugs/issue_22817.yaml new file mode 100644 index 000000000000..d3711323344e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/bugs/issue_22817.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.4 +info: + title: "Different response schemas including an empty one" + version: "1.0.0" +paths: + /example: + get: + operationId: exampleGet + responses: + 200: + description: "A successful response with data" + content: + application/json: + schema: + type: integer + 400: + description: "A bad request with a message" + content: + application/json: + schema: + type: string + 500: + description: "An internal server error with no content" + content: { } diff --git a/samples/client/echo_api/java/resteasy/pom.xml b/samples/client/echo_api/java/resteasy/pom.xml index 8afc65a8756d..c1e6da066eed 100644 --- a/samples/client/echo_api/java/resteasy/pom.xml +++ b/samples/client/echo_api/java/resteasy/pom.xml @@ -260,7 +260,7 @@ 1.3.5 2.9.10 1.0.0 - 3.23.1 + 3.27.7 5.10.2 diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts +++ b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml index 36a3c0a431c7..1cf190a4b585 100644 --- a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml +++ b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml index 653e280f2d34..b56d45044262 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml +++ b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml index 83811f7efb77..5f0ab68ddb74 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml +++ b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml index e683742ec908..ce06aa391784 100644 --- a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml +++ b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/enum-query-params/Cargo.toml b/samples/client/others/rust/reqwest/enum-query-params/Cargo.toml index 9b025fe71ddd..0a22bad218ad 100644 --- a/samples/client/others/rust/reqwest/enum-query-params/Cargo.toml +++ b/samples/client/others/rust/reqwest/enum-query-params/Cargo.toml @@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] } [dev-dependencies] wiremock = "0.6" @@ -21,4 +21,4 @@ tokio = { version = "^1.46.0", features = ["macros", "rt-multi-thread"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml index fb682a1f07f2..971d4b00f14e 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml index 838395ce1b24..3d23b195443e 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml @@ -11,9 +11,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/rust/reqwest/oneOf/Cargo.toml b/samples/client/others/rust/reqwest/oneOf/Cargo.toml index fc08d8321b3b..011f2b721b5f 100644 --- a/samples/client/others/rust/reqwest/oneOf/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf/Cargo.toml @@ -12,9 +12,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/configuration.ts b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/configuration.ts index 2a128451c081..3ce70bf8abaa 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/configuration.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -159,7 +160,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-form/configuration.ts b/samples/client/others/typescript-angular-v20/builds/query-param-form/configuration.ts index 2a128451c081..3ce70bf8abaa 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-form/configuration.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-form/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -159,7 +160,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-json/configuration.ts b/samples/client/others/typescript-angular-v20/builds/query-param-json/configuration.ts index 2a128451c081..3ce70bf8abaa 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-json/configuration.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-json/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -159,7 +160,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts index 2a128451c081..3ce70bf8abaa 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -159,7 +160,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts b/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts index 2a128451c081..3ce70bf8abaa 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -159,7 +160,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/others/typescript-fetch/infinite-recursion-issue/apis/TestApi.ts b/samples/client/others/typescript-fetch/infinite-recursion-issue/apis/TestApi.ts index ba47bcab5145..42a1e35feab7 100644 --- a/samples/client/others/typescript-fetch/infinite-recursion-issue/apis/TestApi.ts +++ b/samples/client/others/typescript-fetch/infinite-recursion-issue/apis/TestApi.ts @@ -28,8 +28,9 @@ import { export class TestApi extends runtime.BaseAPI { /** + * Creates request options for test without sending the request */ - async testRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async testRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -37,12 +38,19 @@ export class TestApi extends runtime.BaseAPI { let urlPath = `/api/v1/test`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async testRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.testRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(TestBaseDtoFromJSON)); } diff --git a/samples/client/others/typescript/builds/array-of-lists/http/http.ts b/samples/client/others/typescript/builds/array-of-lists/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/array-of-lists/http/http.ts +++ b/samples/client/others/typescript/builds/array-of-lists/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/enum-single-value/http/http.ts b/samples/client/others/typescript/builds/enum-single-value/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/enum-single-value/http/http.ts +++ b/samples/client/others/typescript/builds/enum-single-value/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/encode-decode/build/http/http.ts b/samples/client/others/typescript/encode-decode/build/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/client/others/typescript/encode-decode/build/http/http.ts +++ b/samples/client/others/typescript/encode-decode/build/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts +++ b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/client/others/typescript/encode-decode/test/test/server.ts b/samples/client/others/typescript/encode-decode/test/test/server.ts index a32330da9c19..a6747fc6cd08 100644 --- a/samples/client/others/typescript/encode-decode/test/test/server.ts +++ b/samples/client/others/typescript/encode-decode/test/test/server.ts @@ -26,6 +26,7 @@ class TestServerStub implements PromiseHttpLibrary { const body: ResponseBody = { binary: async () => { throw new Error('not implemented') }, text: async () => JSON.stringify(value), + stream: () => null, }; const headers = { 'content-type': 'application/json' }; return new ResponseContext(200, headers, body); @@ -35,6 +36,7 @@ class TestServerStub implements PromiseHttpLibrary { const body: ResponseBody = { binary: async () => { throw new Error('not implemented') }, text: async () => "", + stream: () => null, }; return new ResponseContext(200, {}, body); } else { diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f585f3c0a2f0 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi ///
HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..95e0d7d7ffd3 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..e02712c4078c 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..d89aded6131e 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4244c4daf4ce 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..2239c09bfeb2 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 0f1476c40c26..c1e9012a9965 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..c857ebbb41ad 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..a425a015fb33 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI + * + * OpenAPI + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 41825a6caa05..93eb78fe8829 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ed0fae093ffa 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..fb174003be7c 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..b25e1196a2ba 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..4e10aecc1e0e 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..e79c8ac1a19c 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..39982f5c525d 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e391d54816c1..e1947b346887 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..415af19e3c90 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e831ca2b895a 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Minimal reproduction for csharp webhook bug + * + * This is an example API to reproduce a bug with webhooks in csharp codegen + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 4a2eeb313648..260b523cf349 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5c677ebfe604..c2f5d190fc79 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -69,7 +69,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 47f04ad710a3..f47686424279 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..94b17df95eec 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6d6f0595e3e5 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..bd48c044c3f9 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..5d65f736b3c1 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..e021e476e3ce 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/HostConfiguration.cs index f6ff3ae8fb5e..bba3521b58e8 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -66,7 +66,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..087ef46f1b57 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e3393fd59add..580368b3fa8f 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..53471fdcea21 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..514341827e4d 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Oneof array test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 56f0a7675aec..9ee5d4e3849f 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..5f792eb3eb80 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,13 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +22,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..faf7176d8a44 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,13 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..9760b3a9b118 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,13 @@ // +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +60,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..946bd1f7d757 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,13 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..86137e9617cb 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,13 @@ // +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +26,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..3e0644adaeb3 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,13 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs index ff84d1b3f835..807864f24c64 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -66,9 +66,9 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAPIKEYSApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAPIKeysApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IApiKeysApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..c03f0d4aa569 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,13 @@ // +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +33,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 37880748aed6..8deb80ac2f35 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -22,7 +22,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -74,7 +78,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..49d5af533e92 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,13 @@ // +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +24,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +49,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +83,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..8fd814b7d75f 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,13 @@ // +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +43,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs index a65bd07d9681..cce71626227e 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -22,6 +22,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..65c41d0633ba 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6a6cadccdb3d 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..3f062c6e5399 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..2cd377673b91 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..a3320d0d1b82 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 1a9db5721d53..95f42975580d 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..f84b0c81cfc5 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 7b0510910777..9f0455767aca 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..477aeaead406 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..77adf6a995f9 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 16359b31aa40..c66cdb4ee2a4 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index efaff580a5f9..0d45a7a32e20 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -229,13 +229,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs index 7828441b95e5..601e2a799777 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -181,13 +181,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 9e79cf0877cf..b41e668f3d81 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -68,7 +68,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index f97fb3c5e7a2..d9c123539554 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -179,13 +179,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs index 759667956526..0b1b1097c6a4 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -289,13 +289,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..60c04556c0a0 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..d4ea39986293 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ccd377b6ffa0 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..dec381c8b3cf 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..baef1090e088 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index a1983fd248da..4a76ecc7d311 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ad0ca5cc3ead 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 63af49ff9e42..a679439c57aa 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..0b380a8182ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..fd53a6a1222b 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 36ae5069699f..aa26e4e69804 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..65c41d0633ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6a6cadccdb3d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..3f062c6e5399 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..816c20656472 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..a3320d0d1b82 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2518b0f2bda6..bff2be1c81d1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..6bbbba2f639e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 79b86c53e0cd..0df212257386 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..964ae57ee1b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..d969b1c337cc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index c96d82895566..7ec5cecf4014 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 6e6cadc2371f..cb1edaa5d4d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 6e6cadc2371f..cb1edaa5d4d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5590892c1d41..b5191f41e54e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -227,13 +227,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 5fe566880915..92d0282669fa 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index dea8c2a11c73..11fd1b48d0e6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -64,7 +64,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5d658ec3769d..12a62613371d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -177,13 +177,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 5fe566880915..92d0282669fa 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..60c04556c0a0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..d4ea39986293 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ccd377b6ffa0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..db4fb6f6ac4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..baef1090e088 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index 59bd87967dc3..aa375886659d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -61,7 +61,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..17b973c8f66b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 6443e1b673a8..6f189d0fa7df 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..f16fd503d31d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..ac00629842d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs index a7c8e2a4567e..f11e0d1ad51e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..65c41d0633ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6a6cadccdb3d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..3f062c6e5399 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..816c20656472 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..a3320d0d1b82 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2518b0f2bda6..bff2be1c81d1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..6bbbba2f639e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 79b86c53e0cd..0df212257386 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..964ae57ee1b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..d969b1c337cc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index c96d82895566..7ec5cecf4014 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 6e6cadc2371f..cb1edaa5d4d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 6e6cadc2371f..cb1edaa5d4d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5590892c1d41..b5191f41e54e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -227,13 +227,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 5fe566880915..92d0282669fa 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..2dfab812a89c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index dea8c2a11c73..11fd1b48d0e6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -64,7 +64,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..42188198307c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index e41f3d33abf7..33c9efff7660 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..b90437e247b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..cd0bba0c0132 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 08831f405128..b02febec9d4c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5d658ec3769d..12a62613371d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -177,13 +177,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 5fe566880915..92d0282669fa 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..60c04556c0a0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..d4ea39986293 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ccd377b6ffa0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..db4fb6f6ac4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..baef1090e088 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index 59bd87967dc3..aa375886659d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -61,7 +61,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..17b973c8f66b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 6443e1b673a8..6f189d0fa7df 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -45,7 +49,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..f16fd503d31d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..ac00629842d7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs index a7c8e2a4567e..f11e0d1ad51e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..65c41d0633ba 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6a6cadccdb3d 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..3f062c6e5399 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..2cd377673b91 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..a3320d0d1b82 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 1a9db5721d53..95f42975580d 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..f84b0c81cfc5 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 7b0510910777..9f0455767aca 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..477aeaead406 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..77adf6a995f9 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 16359b31aa40..c66cdb4ee2a4 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index efaff580a5f9..0d45a7a32e20 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -229,13 +229,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs index 7828441b95e5..601e2a799777 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -181,13 +181,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 9e79cf0877cf..b41e668f3d81 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -68,7 +68,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index f97fb3c5e7a2..d9c123539554 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -179,13 +179,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs index 759667956526..0b1b1097c6a4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -289,13 +289,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..60c04556c0a0 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..d4ea39986293 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ccd377b6ffa0 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..dec381c8b3cf 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..baef1090e088 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index a1983fd248da..4a76ecc7d311 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ad0ca5cc3ead 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 63af49ff9e42..a679439c57aa 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..0b380a8182ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..fd53a6a1222b 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 36ae5069699f..aa26e4e69804 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..65c41d0633ba 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..6a6cadccdb3d 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..3f062c6e5399 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..2cd377673b91 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..a3320d0d1b82 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 1a9db5721d53..95f42975580d 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..f84b0c81cfc5 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 7b0510910777..9f0455767aca 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..477aeaead406 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..77adf6a995f9 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 16359b31aa40..c66cdb4ee2a4 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 2e37448fb7d8..2afdd0a137e6 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -67,7 +67,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index efaff580a5f9..0d45a7a32e20 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -229,13 +229,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs index 7828441b95e5..601e2a799777 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -181,13 +181,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..ad5ab9cfa9a3 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..a82fd66226e3 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..98e63e13d068 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..8c8b0435c1c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..4a7d7f4afd08 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 9e79cf0877cf..b41e668f3d81 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -68,7 +68,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ae6194f0d4fd 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 413887f07db1..77d36ad1aa38 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..acbbccb65582 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..2529186409d8 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 0f375142c129..7f56320e4115 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index f97fb3c5e7a2..d9c123539554 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -179,13 +179,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index be9379a5634d..b3e2c32d4ed1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs index d0b10f69b91e..f5f603c4e3c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -51,4 +59,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs index 01e79ed16ed2..199c1c236136 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -41,4 +49,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs index b2d4591d46b9..eff990384e27 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..f55af84d3122 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs index 759667956526..0b1b1097c6a4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -289,13 +289,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 5d5338cb9e61..9819949b502e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -40,4 +48,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..6a0910ea6c71 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs index 3544d55c373c..fee5c1b86e31 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -36,4 +44,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index aedb1cef12fa..674ae48622db 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -73,7 +77,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..5bb1044f772c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..e1910b2d58e7 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 2d668528ef65..3528b94f6725 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..60c04556c0a0 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..d4ea39986293 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ccd377b6ffa0 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs index 85093b0c1fee..dec381c8b3cf 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -17,4 +25,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..baef1090e088 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index a1983fd248da..4a76ecc7d311 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -63,7 +63,7 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 0184d9ad9446..ad0ca5cc3ead 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -24,4 +32,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 63af49ff9e42..a679439c57aa 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs index aa6df45cf7c0..0b380a8182ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -15,11 +23,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler? TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler? TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -33,7 +48,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -68,4 +82,4 @@ private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 7b0f23d28a4e..fd53a6a1222b 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ #nullable enable @@ -34,4 +42,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 36ae5069699f..aa26e4e69804 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -21,6 +21,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/IApi.cs index 28520f043f2d..f11d0bfc797f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/IApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System.Net.Http; namespace Org.OpenAPITools.Api @@ -12,4 +21,4 @@ public interface IApi /// HttpClient HttpClient { get; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs index b9b27c613f86..006a2ec37991 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs index 4ae15cda355e..2499533cba7c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -49,4 +57,4 @@ public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage reques parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs index 3cb65e5adc0b..ce3efa1aaaf6 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs index bde0562e1940..867cf1d717bc 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -39,4 +47,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs index 4337ac9a7736..a701ee8d0dcd 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs index da94287dab88..63b7093df708 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -15,4 +23,4 @@ public sealed class CookieContainer /// public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index f711f9f3c7ee..49e1cd0c9152 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -1,3 +1,12 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + using System; namespace Org.OpenAPITools.Client diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5d658ec3769d..12a62613371d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -177,13 +177,13 @@ public HostConfiguration AddApiHttpClients List builders = new List(); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IAnotherFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IDefaultApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IFakeClassnameTags123Api", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IPetApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IStoreApi", client)); + builders.Add(_services.AddHttpClient("Org.OpenAPITools.Api.IUserApi", client)); if (builder != null) foreach (IHttpClientBuilder instance in builders) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs index 387f7a8829e8..ad45bd0bc3af 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -38,4 +46,4 @@ public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, stri request.Headers.Add(signedHeader.Key, signedHeader.Value); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs index 8fd6b68578f0..ee0db494080a 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Text.Json; @@ -22,4 +30,4 @@ public JsonSerializerOptionsProvider(JsonSerializerOptions options) Options = options; } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs index 209e913db3e0..199ec310d268 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; using System.Linq; @@ -34,4 +42,4 @@ public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage reque request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 5fe566880915..92d0282669fa 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -19,7 +19,11 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - public Dictionary> AvailableTokens { get; } = new Dictionary>(); + /// + /// Dictionary mapping header names to channels of available tokens for rate limiting. + /// Each channel buffers tokens that have become available and are ready for use. + /// + protected internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -71,7 +75,7 @@ public RateLimitProvider(TokenContainer container) : base() } /// - public override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + protected internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs index 11cddf564b33..744e156cd16f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System; @@ -13,11 +21,18 @@ public abstract class TokenBase private object _nextAvailableLock = new object(); private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - internal TimeSpan? Timeout { get; set; } + + /// + /// Delegate for token availability notification events. + /// + /// The token that became available. public delegate void TokenBecameAvailableEventHandler(object sender); - public event TokenBecameAvailableEventHandler TokenBecameAvailable; + /// + /// Event raised when a rate-limited token becomes available for use. + /// + public event TokenBecameAvailableEventHandler TokenBecameAvailable; /// /// Initialize a TokenBase object. @@ -31,7 +46,6 @@ internal TokenBase(TimeSpan? timeout = null) StartTimer(Timeout.Value); } - /// /// Starts the token's timer /// @@ -66,4 +80,4 @@ private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) TokenBecameAvailable.Invoke(this); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs index 1e81bcd48886..c39958a248c8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -1,4 +1,12 @@ // +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ using System.Linq; using System.Collections.Generic; @@ -32,4 +40,4 @@ public TokenContainer(global::System.Collections.Generic.IEnumerable Tokens = tokens.ToList(); } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs index 1a9a30116ee5..4b00ebf1d497 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -19,6 +19,12 @@ namespace Org.OpenAPITools /// public abstract class TokenProvider where TTokenBase : TokenBase { - public abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + /// + /// Gets a token asynchronously for the specified header. + /// + /// The header name to retrieve a token for. Empty string for non-API-key authentication schemes. + /// Cancellation token for the asynchronous operation. + /// A task that returns the requested token. + protected internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); } } \ No newline at end of file diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index fb7db6b69d3b..bd7c0e4fb215 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -260,7 +260,7 @@ 1.3.5 2.9.10 1.0.0 - 3.23.1 + 3.27.7 5.10.2 diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml index ce1ec4c1f002..247dd258ab92 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml @@ -14,10 +14,10 @@ serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } async-trait = "^0.1" -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } mockall = { version = "^0.13", optional = true} [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] mockall = ["dep:mockall"] diff --git a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml index 8451184f7495..2c14c58a1fe6 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml @@ -11,9 +11,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml index 9becf795bdbf..828fb5eed7b9 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml @@ -15,10 +15,10 @@ url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } -reqwest-middleware = { version = "^0.4", features = ["json", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } +reqwest-middleware = { version = "^0.5", features = ["json", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/Cargo.toml index ee6b233ed2d5..8c048ea5011b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/Cargo.toml @@ -15,7 +15,7 @@ url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } async-trait = "^0.1" # TODO: propose to Yoshidan to externalize this as non google related crate, so that it can easily be extended for other cloud providers. google-cloud-token = "^0.1" @@ -23,4 +23,4 @@ google-cloud-token = "^0.1" [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml index 4b87528314bf..669e37f37908 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml @@ -15,7 +15,7 @@ url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } [dev-dependencies] wiremock = "0.6" @@ -24,4 +24,4 @@ tokio = { version = "^1.46.0", features = ["macros", "rt-multi-thread"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml index b1a31cbb3202..07d1d1b5e45f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml @@ -15,9 +15,9 @@ url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml index 048bdddf20f7..e7abf677ae26 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml @@ -16,9 +16,9 @@ uuid = { version = "^1.8", features = ["serde", "v4"] } aws-sigv4 = "0.3.0" http = "0.2.5" secrecy = "0.8.0" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/Cargo.toml index 87da9d394194..f169c7176d0c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/Cargo.toml @@ -13,9 +13,9 @@ serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore-serde-path-to-error/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-serde-path-to-error/Cargo.toml index d9a47c26ea2e..0fe629323f08 100644 --- a/samples/client/petstore/rust/reqwest/petstore-serde-path-to-error/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-serde-path-to-error/Cargo.toml @@ -16,9 +16,9 @@ url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } tokio = { version = "^1.46.0", features = ["fs"] } tokio-util = { version = "^0.7", features = ["codec"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml index a7b21616b3e2..d9ee0b5e481a 100644 --- a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml @@ -13,7 +13,7 @@ serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [dev-dependencies] wiremock = "0.6" @@ -22,4 +22,4 @@ tokio = { version = "^1.46.0", features = ["macros", "rt-multi-thread"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/rust/reqwest/test-duplicates/Cargo.toml b/samples/client/petstore/rust/reqwest/test-duplicates/Cargo.toml index 758ea1c37ee9..b6a0d3d9176c 100644 --- a/samples/client/petstore/rust/reqwest/test-duplicates/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/test-duplicates/Cargo.toml @@ -11,9 +11,9 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } [features] default = ["native-tls"] native-tls = ["reqwest/native-tls"] -rustls-tls = ["reqwest/rustls-tls"] +rustls = ["reqwest/rustls"] diff --git a/samples/client/petstore/swift6/alamofireLibrary/Package.swift b/samples/client/petstore/swift6/alamofireLibrary/Package.swift index 18f505a86cf9..14caee878209 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Package.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/alamofireLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/alamofireLibrary/PetstoreClient.podspec index 71c84bc1ffc7..2009ff08bb92 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/alamofireLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index fff700bc9495..542ab429d641 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -61,7 +61,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -109,7 +109,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 6ab188305e2f..1efeb37227d1 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -7,7 +7,7 @@ import Foundation import Alamofire -public class AlamofireRequestBuilderFactory: RequestBuilderFactory { +public final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 788f242d4be7..c1df20ed54ce 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 20b9f39957cb..987b5ced9dab 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -377,7 +377,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -392,7 +392,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -407,7 +407,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -422,7 +422,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -439,7 +439,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Package.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Package.swift index 58fb81d22bd1..53575c9c1efa 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Package.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/PetstoreClient.podspec b/samples/client/petstore/swift6/apiNonStaticMethod/PetstoreClient.podspec index 5694a8439b48..f89cfddbadd6 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/apiNonStaticMethod/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index fa30c04d2fdd..3fd9f250805d 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class AnotherFakeAPI { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -86,8 +84,6 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func call123testSpecialTags(body: Client) -> AnyPublisher { let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -109,7 +105,6 @@ open class AnotherFakeAPI { } .eraseToAnyPublisher() } - #endif /** To test special tags @@ -117,7 +112,6 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func call123testSpecialTags(body: Client) async throws(ErrorResponse) -> Client { return try await call123testSpecialTagsWithRequestBuilder(body: body).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift index f46c42cd9edd..9099e3f6fb3c 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class FakeAPI { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -82,8 +80,6 @@ open class FakeAPI { - parameter body: (body) Input boolean as post body (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterBooleanSerialize(body: Bool? = nil) -> AnyPublisher { let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -105,14 +101,12 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - parameter body: (body) Input boolean as post body (optional) - returns: Bool */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterBooleanSerialize(body: Bool? = nil) async throws(ErrorResponse) -> Bool { return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute().body } @@ -222,8 +216,6 @@ open class FakeAPI { - parameter body: (body) Input composite as post body (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterCompositeSerialize(body: OuterComposite? = nil) -> AnyPublisher { let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -245,14 +237,12 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - parameter body: (body) Input composite as post body (optional) - returns: OuterComposite */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterCompositeSerialize(body: OuterComposite? = nil) async throws(ErrorResponse) -> OuterComposite { return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute().body } @@ -362,8 +352,6 @@ open class FakeAPI { - parameter body: (body) Input number as post body (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterNumberSerialize(body: Double? = nil) -> AnyPublisher { let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -385,14 +373,12 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - parameter body: (body) Input number as post body (optional) - returns: Double */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterNumberSerialize(body: Double? = nil) async throws(ErrorResponse) -> Double { return try await fakeOuterNumberSerializeWithRequestBuilder(body: body).execute().body } @@ -502,8 +488,6 @@ open class FakeAPI { - parameter body: (body) Input string as post body (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterStringSerialize(body: String? = nil) -> AnyPublisher { let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -525,14 +509,12 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - parameter body: (body) Input string as post body (optional) - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func fakeOuterStringSerialize(body: String? = nil) async throws(ErrorResponse) -> String { return try await fakeOuterStringSerializeWithRequestBuilder(body: body).execute().body } @@ -642,8 +624,6 @@ open class FakeAPI { - parameter body: (body) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testBodyWithFileSchema(body: FileSchemaTestClass) -> AnyPublisher { let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -665,14 +645,12 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - parameter body: (body) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testBodyWithFileSchema(body: FileSchemaTestClass) async throws(ErrorResponse) { return try await testBodyWithFileSchemaWithRequestBuilder(body: body).execute().body } @@ -786,8 +764,6 @@ open class FakeAPI { - parameter body: (body) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testBodyWithQueryParams(query: String, body: User) -> AnyPublisher { let requestBuilder = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body) let requestTask = requestBuilder.requestTask @@ -809,7 +785,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** @@ -817,7 +792,6 @@ open class FakeAPI { - parameter body: (body) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testBodyWithQueryParams(query: String, body: User) async throws(ErrorResponse) { return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute().body } @@ -935,8 +909,6 @@ open class FakeAPI { - parameter body: (body) client model - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testClientModel(body: Client) -> AnyPublisher { let requestBuilder = testClientModelWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -958,7 +930,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** To test \"client\" model @@ -966,7 +937,6 @@ open class FakeAPI { - parameter body: (body) client model - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testClientModel(body: Client) async throws(ErrorResponse) -> Client { return try await testClientModelWithRequestBuilder(body: body).execute().body } @@ -1134,8 +1104,6 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> AnyPublisher { let requestBuilder = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback) let requestTask = requestBuilder.requestTask @@ -1157,7 +1125,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1178,7 +1145,6 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) async throws(ErrorResponse) { return try await testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute().body } @@ -1436,8 +1402,6 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> AnyPublisher { let requestBuilder = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) let requestTask = requestBuilder.requestTask @@ -1459,7 +1423,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** To test enum parameters @@ -1474,7 +1437,6 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) async throws(ErrorResponse) { return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute().body } @@ -1638,8 +1600,6 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> AnyPublisher { let requestBuilder = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group) let requestTask = requestBuilder.requestTask @@ -1661,7 +1621,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** Fake endpoint to test group parameters (optional) @@ -1674,7 +1633,6 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) async throws(ErrorResponse) { return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute().body } @@ -1807,8 +1765,6 @@ open class FakeAPI { - parameter param: (body) request body - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testInlineAdditionalProperties(param: [String: String]) -> AnyPublisher { let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param) let requestTask = requestBuilder.requestTask @@ -1830,7 +1786,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** test inline additionalProperties @@ -1838,7 +1793,6 @@ open class FakeAPI { - parameter param: (body) request body - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testInlineAdditionalProperties(param: [String: String]) async throws(ErrorResponse) { return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute().body } @@ -1957,8 +1911,6 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testJsonFormData(param: String, param2: String) -> AnyPublisher { let requestBuilder = testJsonFormDataWithRequestBuilder(param: param, param2: param2) let requestTask = requestBuilder.requestTask @@ -1980,7 +1932,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** test json serialization of form data @@ -1989,7 +1940,6 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testJsonFormData(param: String, param2: String) async throws(ErrorResponse) { return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 3836355cd3f9..589147ee7b0b 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class FakeClassnameTags123API { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -86,8 +84,6 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testClassname(body: Client) -> AnyPublisher { let requestBuilder = testClassnameWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -109,7 +105,6 @@ open class FakeClassnameTags123API { } .eraseToAnyPublisher() } - #endif /** To test class name in snake case @@ -117,7 +112,6 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func testClassname(body: Client) async throws(ErrorResponse) -> Client { return try await testClassnameWithRequestBuilder(body: body).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift index 907cbd4185f2..17663917bc84 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class PetAPI { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -86,8 +84,6 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func addPet(body: Pet) -> AnyPublisher { let requestBuilder = addPetWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -109,7 +105,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Add a new pet to the store @@ -117,7 +112,6 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func addPet(body: Pet) async throws(ErrorResponse) { return try await addPetWithRequestBuilder(body: body).execute().body } @@ -242,8 +236,6 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deletePet(petId: Int64, apiKey: String? = nil) -> AnyPublisher { let requestBuilder = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey) let requestTask = requestBuilder.requestTask @@ -265,7 +257,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Deletes a pet @@ -274,7 +265,6 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deletePet(petId: Int64, apiKey: String? = nil) async throws(ErrorResponse) { return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute().body } @@ -406,8 +396,6 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func findPetsByStatus(status: [Status_findPetsByStatus]) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByStatusWithRequestBuilder(status: status) let requestTask = requestBuilder.requestTask @@ -429,7 +417,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Finds Pets by status @@ -437,7 +424,6 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: [Pet] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func findPetsByStatus(status: [Status_findPetsByStatus]) async throws(ErrorResponse) -> [Pet] { return try await findPetsByStatusWithRequestBuilder(status: status).execute().body } @@ -561,9 +547,7 @@ open class PetAPI { - parameter tags: (query) Tags to filter by - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func findPetsByTags(tags: [String]) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags) let requestTask = requestBuilder.requestTask @@ -585,7 +569,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Finds Pets by tags @@ -594,7 +577,6 @@ open class PetAPI { - returns: [Pet] */ @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func findPetsByTags(tags: [String]) async throws(ErrorResponse) -> [Pet] { return try await findPetsByTagsWithRequestBuilder(tags: tags).execute().body } @@ -718,8 +700,6 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getPetById(petId: Int64) -> AnyPublisher { let requestBuilder = getPetByIdWithRequestBuilder(petId: petId) let requestTask = requestBuilder.requestTask @@ -741,7 +721,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Find pet by ID @@ -749,7 +728,6 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: Pet */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getPetById(petId: Int64) async throws(ErrorResponse) -> Pet { return try await getPetByIdWithRequestBuilder(petId: petId).execute().body } @@ -871,8 +849,6 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updatePet(body: Pet) -> AnyPublisher { let requestBuilder = updatePetWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -894,7 +870,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Update an existing pet @@ -902,7 +877,6 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updatePet(body: Pet) async throws(ErrorResponse) { return try await updatePetWithRequestBuilder(body: body).execute().body } @@ -1028,8 +1002,6 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil) -> AnyPublisher { let requestBuilder = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status) let requestTask = requestBuilder.requestTask @@ -1051,7 +1023,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Updates a pet in the store with form data @@ -1061,7 +1032,6 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil) async throws(ErrorResponse) { return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute().body } @@ -1200,8 +1170,6 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> AnyPublisher { let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file) let requestTask = requestBuilder.requestTask @@ -1223,7 +1191,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** uploads an image @@ -1233,7 +1200,6 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute().body } @@ -1372,8 +1338,6 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> AnyPublisher { let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata) let requestTask = requestBuilder.requestTask @@ -1395,7 +1359,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** uploads an image (required) @@ -1405,7 +1368,6 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift index f77b823db725..2b946167ddea 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class StoreAPI { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -86,8 +84,6 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deleteOrder(orderId: String) -> AnyPublisher { let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId) let requestTask = requestBuilder.requestTask @@ -109,7 +105,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Delete purchase order by ID @@ -117,7 +112,6 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deleteOrder(orderId: String) async throws(ErrorResponse) { return try await deleteOrderWithRequestBuilder(orderId: orderId).execute().body } @@ -232,8 +226,6 @@ open class StoreAPI { - returns: AnyPublisher<[String: Int], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getInventory() -> AnyPublisher<[String: Int], Error> { let requestBuilder = getInventoryWithRequestBuilder() let requestTask = requestBuilder.requestTask @@ -255,14 +247,12 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Returns pet inventories by status - returns: [String: Int] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getInventory() async throws(ErrorResponse) -> [String: Int] { return try await getInventoryWithRequestBuilder().execute().body } @@ -379,8 +369,6 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getOrderById(orderId: Int64) -> AnyPublisher { let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId) let requestTask = requestBuilder.requestTask @@ -402,7 +390,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Find purchase order by ID @@ -410,7 +397,6 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getOrderById(orderId: Int64) async throws(ErrorResponse) -> Order { return try await getOrderByIdWithRequestBuilder(orderId: orderId).execute().body } @@ -529,8 +515,6 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func placeOrder(body: Order) -> AnyPublisher { let requestBuilder = placeOrderWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -552,7 +536,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Place an order for a pet @@ -560,7 +543,6 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func placeOrder(body: Order) async throws(ErrorResponse) -> Order { return try await placeOrderWithRequestBuilder(body: body).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift index c64954a0c842..81ace7af9c76 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift @@ -8,9 +8,7 @@ import Foundation @preconcurrency import PromiseKit @preconcurrency import RxSwift -#if canImport(Combine) import Combine -#endif open class UserAPI { public let apiConfiguration: PetstoreClientAPIConfiguration @@ -86,8 +84,6 @@ open class UserAPI { - parameter body: (body) Created user object - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUser(body: User) -> AnyPublisher { let requestBuilder = createUserWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -109,7 +105,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Create user @@ -117,7 +112,6 @@ open class UserAPI { - parameter body: (body) Created user object - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUser(body: User) async throws(ErrorResponse) { return try await createUserWithRequestBuilder(body: body).execute().body } @@ -233,8 +227,6 @@ open class UserAPI { - parameter body: (body) List of user object - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUsersWithArrayInput(body: [User]) -> AnyPublisher { let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -256,7 +248,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -264,7 +255,6 @@ open class UserAPI { - parameter body: (body) List of user object - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUsersWithArrayInput(body: [User]) async throws(ErrorResponse) { return try await createUsersWithArrayInputWithRequestBuilder(body: body).execute().body } @@ -379,8 +369,6 @@ open class UserAPI { - parameter body: (body) List of user object - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUsersWithListInput(body: [User]) -> AnyPublisher { let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body) let requestTask = requestBuilder.requestTask @@ -402,7 +390,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -410,7 +397,6 @@ open class UserAPI { - parameter body: (body) List of user object - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func createUsersWithListInput(body: [User]) async throws(ErrorResponse) { return try await createUsersWithListInputWithRequestBuilder(body: body).execute().body } @@ -525,8 +511,6 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deleteUser(username: String) -> AnyPublisher { let requestBuilder = deleteUserWithRequestBuilder(username: username) let requestTask = requestBuilder.requestTask @@ -548,7 +532,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Delete user @@ -556,7 +539,6 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func deleteUser(username: String) async throws(ErrorResponse) { return try await deleteUserWithRequestBuilder(username: username).execute().body } @@ -675,8 +657,6 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getUserByName(username: String) -> AnyPublisher { let requestBuilder = getUserByNameWithRequestBuilder(username: username) let requestTask = requestBuilder.requestTask @@ -698,7 +678,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Get user by user name @@ -706,7 +685,6 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: User */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func getUserByName(username: String) async throws(ErrorResponse) -> User { return try await getUserByNameWithRequestBuilder(username: username).execute().body } @@ -828,8 +806,6 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func loginUser(username: String, password: String) -> AnyPublisher { let requestBuilder = loginUserWithRequestBuilder(username: username, password: password) let requestTask = requestBuilder.requestTask @@ -851,7 +827,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Logs user into the system @@ -860,7 +835,6 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func loginUser(username: String, password: String) async throws(ErrorResponse) -> String { return try await loginUserWithRequestBuilder(username: username, password: password).execute().body } @@ -978,8 +952,6 @@ open class UserAPI { - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func logoutUser() -> AnyPublisher { let requestBuilder = logoutUserWithRequestBuilder() let requestTask = requestBuilder.requestTask @@ -1001,14 +973,12 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Logs out current logged in user session - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func logoutUser() async throws(ErrorResponse) { return try await logoutUserWithRequestBuilder().execute().body } @@ -1125,8 +1095,6 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updateUser(username: String, body: User) -> AnyPublisher { let requestBuilder = updateUserWithRequestBuilder(username: username, body: body) let requestTask = requestBuilder.requestTask @@ -1148,7 +1116,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Updated user @@ -1157,7 +1124,6 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open func updateUser(username: String, body: User) async throws(ErrorResponse) { return try await updateUserWithRequestBuilder(username: username, body: body).execute().body } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift index e697fa560e49..7af51bae5a73 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -61,7 +61,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -97,9 +97,21 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + #if compiler(>=6.2) + @concurrent @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -113,7 +125,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -131,7 +142,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -144,7 +155,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 6ab188305e2f..1efeb37227d1 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -7,7 +7,7 @@ import Foundation import Alamofire -public class AlamofireRequestBuilderFactory: RequestBuilderFactory { +public final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift index 788f242d4be7..c1df20ed54ce 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 5d8e2b735c11..01614fe0b7c1 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -379,7 +379,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -394,7 +394,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -410,7 +410,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -427,7 +427,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -446,7 +446,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0bbc2634349d..6fc5b36f26de 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "472bd6166910f63c0cf0e9ff6ab969628489a7027357cae71bd565f99926ca6b", + "originHash" : "6e8e02fd42383a709bd1233e242575a29d1c56271477e2781924330451956ee8", "pins" : [ { "identity" : "alamofire", "kind" : "remoteSourceControl", "location" : "https://github.com/Alamofire/Alamofire", "state" : { - "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a", - "version" : "5.9.1" + "revision" : "7be73f6c2b5cd90e40798b06ebd5da8f9f79cf88", + "version" : "5.11.0" } }, { diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Package.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Package.swift index 0c83fdb87472..12cadf5a51e4 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Package.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/asyncAwaitLibrary/PetstoreClient.podspec index a438db340972..73466e6b7964 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 961bc491b4ea..da0b4b8600eb 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -16,7 +16,6 @@ open class AnotherFakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 8c2a987f7c77..b49efe04738f 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -15,7 +15,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Bool */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Bool { return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -51,7 +50,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: OuterComposite */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> OuterComposite { return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -87,7 +85,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Double */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Double { return try await fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -123,7 +120,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> String { return try await fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -159,7 +155,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -196,7 +191,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute().body } @@ -236,7 +230,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -287,7 +280,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, apiConfiguration: apiConfiguration).execute().body } @@ -433,7 +425,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute().body } @@ -497,7 +488,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute().body } @@ -547,7 +537,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute().body } @@ -585,7 +574,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 77649e663603..c74c7891b577 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -16,7 +16,6 @@ open class FakeClassnameTags123API { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index e7e2b597031e..d7780802743c 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -16,7 +16,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -60,7 +59,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute().body } @@ -113,7 +111,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: [Pet] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [Pet] { return try await findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute().body } @@ -158,7 +155,6 @@ open class PetAPI { - returns: [Pet] */ @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [Pet] { return try await findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute().body } @@ -203,7 +199,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Pet */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Pet { return try await getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute().body } @@ -247,7 +242,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -289,7 +283,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute().body } @@ -342,7 +335,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute().body } @@ -395,7 +387,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 06e30274cec6..7688e9f4456b 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -16,7 +16,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } @@ -56,7 +55,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: [String: Int] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [String: Int] { return try await getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } @@ -96,7 +94,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { return try await getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } @@ -137,7 +134,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { return try await placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index bb05d9be0a52..27c4877f4bfb 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -16,7 +16,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -54,7 +53,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -91,7 +89,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -128,7 +125,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } @@ -169,7 +165,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: User */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> User { return try await getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } @@ -210,7 +205,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> String { return try await loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute().body } @@ -252,7 +246,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } @@ -289,7 +282,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index 1d94b12a8166..89dc30b72299 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,21 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + #if compiler(>=6.2) + @concurrent @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +111,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +128,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +141,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/asyncAwaitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 5d8e2b735c11..01614fe0b7c1 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -379,7 +379,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -394,7 +394,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -410,7 +410,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -427,7 +427,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -446,7 +446,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/Package.swift b/samples/client/petstore/swift6/combineDeferredLibrary/Package.swift index dc5bc46564c7..72355e07f87c 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/Package.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient.podspec index d5b8cefeffa0..ca2fc21a4068 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index fa46919c4280..7ec0b170dc6a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class AnotherFakeAPI { @@ -19,8 +17,6 @@ open class AnotherFakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -42,7 +38,6 @@ open class AnotherFakeAPI { } .eraseToAnyPublisher() } - #endif /** To test special tags diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 554d10d64d99..ece27744dea4 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class FakeAPI { @@ -18,8 +16,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -41,7 +37,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/boolean @@ -74,8 +69,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -97,7 +90,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/composite @@ -130,8 +122,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -153,7 +143,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/number @@ -186,8 +175,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -209,7 +196,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/string @@ -242,8 +228,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -265,7 +249,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - PUT /fake/body-with-file-schema @@ -299,8 +282,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -322,7 +303,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** - PUT /fake/body-with-query-params @@ -359,8 +339,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -382,7 +360,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** To test \"client\" model @@ -430,8 +407,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -453,7 +428,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -596,8 +570,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -619,7 +591,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** To test enum parameters @@ -680,8 +651,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -703,7 +672,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** Fake endpoint to test group parameters (optional) @@ -750,8 +718,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -773,7 +739,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** test inline additionalProperties @@ -808,8 +773,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -831,7 +794,6 @@ open class FakeAPI { } .eraseToAnyPublisher() } - #endif /** test json serialization of form data diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 856096b9e755..c1d52cf266ad 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class FakeClassnameTags123API { @@ -19,8 +17,6 @@ open class FakeClassnameTags123API { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -42,7 +38,6 @@ open class FakeClassnameTags123API { } .eraseToAnyPublisher() } - #endif /** To test class name in snake case diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index eed0d1d858bc..57e24357592a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class PetAPI { @@ -19,8 +17,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -42,7 +38,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Add a new pet to the store @@ -83,8 +78,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -106,7 +99,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Deletes a pet @@ -156,8 +148,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -179,7 +169,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Finds Pets by status @@ -220,9 +209,7 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -244,7 +231,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Finds Pets by tags @@ -286,8 +272,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -309,7 +293,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Find pet by ID @@ -350,8 +333,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -373,7 +354,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Update an existing pet @@ -412,8 +392,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -435,7 +413,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** Updates a pet in the store with form data @@ -485,8 +462,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -508,7 +483,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** uploads an image @@ -558,8 +532,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -581,7 +553,6 @@ open class PetAPI { } .eraseToAnyPublisher() } - #endif /** uploads an image (required) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 8765e5c381a0..79f389577712 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class StoreAPI { @@ -19,8 +17,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -42,7 +38,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Delete purchase order by ID @@ -79,8 +74,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[String: Int], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[String: Int], Error> { let requestBuilder = getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -102,7 +95,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Returns pet inventories by status @@ -139,8 +131,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -162,7 +152,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Find purchase order by ID @@ -200,8 +189,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -223,7 +210,6 @@ open class StoreAPI { } .eraseToAnyPublisher() } - #endif /** Place an order for a pet diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index a78a864eb0ce..83805666261a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class UserAPI { @@ -19,8 +17,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -42,7 +38,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Create user @@ -77,8 +72,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -100,7 +93,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -134,8 +126,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -157,7 +147,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -191,8 +180,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -214,7 +201,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Delete user @@ -252,8 +238,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -275,7 +259,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Get user by user name @@ -313,8 +296,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -336,7 +317,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Logs user into the system @@ -375,8 +355,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -398,7 +376,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Logs out current logged in user session @@ -432,8 +409,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -455,7 +430,6 @@ open class UserAPI { } .eraseToAnyPublisher() } - #endif /** Updated user diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/combineDeferredLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 5d8e2b735c11..01614fe0b7c1 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/combineDeferredLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -379,7 +379,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -394,7 +394,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -410,7 +410,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -427,7 +427,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -446,7 +446,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/combineLibrary/Package.swift b/samples/client/petstore/swift6/combineLibrary/Package.swift index dc3d9db7cf9b..b6869469bd51 100644 --- a/samples/client/petstore/swift6/combineLibrary/Package.swift +++ b/samples/client/petstore/swift6/combineLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/combineLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/combineLibrary/PetstoreClient.podspec index ead132efcb15..81ffb632ce39 100644 --- a/samples/client/petstore/swift6/combineLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/combineLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift index 2cae740c373c..d3f7f11f1180 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class AnotherFakeAPI { @@ -19,8 +17,6 @@ open class AnotherFakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -40,7 +36,6 @@ open class AnotherFakeAPI { }) .eraseToAnyPublisher() } - #endif /** To test special tags diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift index a1941d1ca55b..3cd0c634bb1b 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class FakeAPI { @@ -18,8 +16,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -39,7 +35,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/boolean @@ -72,8 +67,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -93,7 +86,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/composite @@ -126,8 +118,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -147,7 +137,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/number @@ -180,8 +169,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -201,7 +188,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - POST /fake/outer/string @@ -234,8 +220,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -255,7 +239,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - PUT /fake/body-with-file-schema @@ -289,8 +272,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -310,7 +291,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** - PUT /fake/body-with-query-params @@ -347,8 +327,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -368,7 +346,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** To test \"client\" model @@ -416,8 +393,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -437,7 +412,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -580,8 +554,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -601,7 +573,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** To test enum parameters @@ -662,8 +633,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -683,7 +652,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** Fake endpoint to test group parameters (optional) @@ -730,8 +698,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -751,7 +717,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** test inline additionalProperties @@ -786,8 +751,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -807,7 +770,6 @@ open class FakeAPI { }) .eraseToAnyPublisher() } - #endif /** test json serialization of form data diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift index d5fdb809489e..0ddc8a37347a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class FakeClassnameTags123API { @@ -19,8 +17,6 @@ open class FakeClassnameTags123API { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -40,7 +36,6 @@ open class FakeClassnameTags123API { }) .eraseToAnyPublisher() } - #endif /** To test class name in snake case diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift index 903bf2abb822..a6bfa12afc00 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class PetAPI { @@ -19,8 +17,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -40,7 +36,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Add a new pet to the store @@ -81,8 +76,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -102,7 +95,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Deletes a pet @@ -152,8 +144,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -173,7 +163,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Finds Pets by status @@ -214,9 +203,7 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[Pet], Error> */ - #if canImport(Combine) @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -236,7 +223,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Finds Pets by tags @@ -278,8 +264,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -299,7 +283,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Find pet by ID @@ -340,8 +323,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -361,7 +342,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Update an existing pet @@ -400,8 +380,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -421,7 +399,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** Updates a pet in the store with form data @@ -471,8 +448,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -492,7 +467,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** uploads an image @@ -542,8 +516,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -563,7 +535,6 @@ open class PetAPI { }) .eraseToAnyPublisher() } - #endif /** uploads an image (required) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift index 8f7ce1deb9bf..855564927ada 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class StoreAPI { @@ -19,8 +17,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -40,7 +36,6 @@ open class StoreAPI { }) .eraseToAnyPublisher() } - #endif /** Delete purchase order by ID @@ -77,8 +72,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher<[String: Int], Error> */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[String: Int], Error> { let requestBuilder = getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -98,7 +91,6 @@ open class StoreAPI { }) .eraseToAnyPublisher() } - #endif /** Returns pet inventories by status @@ -135,8 +127,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -156,7 +146,6 @@ open class StoreAPI { }) .eraseToAnyPublisher() } - #endif /** Find purchase order by ID @@ -194,8 +183,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -215,7 +202,6 @@ open class StoreAPI { }) .eraseToAnyPublisher() } - #endif /** Place an order for a pet diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift index 1603f7bcea36..ee8e562af1ff 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift @@ -6,9 +6,7 @@ // import Foundation -#if canImport(Combine) import Combine -#endif open class UserAPI { @@ -19,8 +17,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -40,7 +36,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Create user @@ -75,8 +70,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -96,7 +89,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -130,8 +122,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -151,7 +141,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Creates list of users with given input array @@ -185,8 +174,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -206,7 +193,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Delete user @@ -244,8 +230,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -265,7 +249,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Get user by user name @@ -303,8 +286,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -324,7 +305,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Logs user into the system @@ -363,8 +343,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -384,7 +362,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Logs out current logged in user session @@ -418,8 +395,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: AnyPublisher */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { let requestBuilder = updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask @@ -439,7 +414,6 @@ open class UserAPI { }) .eraseToAnyPublisher() } - #endif /** Updated user diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/combineLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/combineLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 5d8e2b735c11..01614fe0b7c1 100644 --- a/samples/client/petstore/swift6/combineLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/combineLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -379,7 +379,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -394,7 +394,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -410,7 +410,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -427,7 +427,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -446,7 +446,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/default/Package.swift b/samples/client/petstore/swift6/default/Package.swift index 0c83fdb87472..12cadf5a51e4 100644 --- a/samples/client/petstore/swift6/default/Package.swift +++ b/samples/client/petstore/swift6/default/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/default/PetstoreClient.podspec b/samples/client/petstore/swift6/default/PetstoreClient.podspec index a438db340972..73466e6b7964 100644 --- a/samples/client/petstore/swift6/default/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/default/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index b4a5ba18dbb0..d75a31e4605a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -17,7 +17,6 @@ open class AnotherFakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(uuidTest: UUID, body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await call123testSpecialTagsWithRequestBuilder(uuidTest: uuidTest, body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift index 1a841ea0b02d..49f224142bc1 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -16,7 +16,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createXmlItem(xmlItem: XmlItem, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createXmlItemWithRequestBuilder(xmlItem: xmlItem, apiConfiguration: apiConfiguration).execute().body } @@ -53,7 +52,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Bool */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Bool { return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -89,7 +87,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: OuterComposite */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> OuterComposite { return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -125,7 +122,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Double */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Double { return try await fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -161,7 +157,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> String { return try await fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -197,7 +192,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -234,7 +228,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute().body } @@ -274,7 +267,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -325,7 +317,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, apiConfiguration: apiConfiguration).execute().body } @@ -471,7 +462,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute().body } @@ -535,7 +525,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute().body } @@ -585,7 +574,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute().body } @@ -623,7 +611,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute().body } @@ -670,7 +657,6 @@ open class FakeAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await testQueryParameterCollectionFormatWithRequestBuilder(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 77649e663603..c74c7891b577 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -16,7 +16,6 @@ open class FakeClassnameTags123API { - parameter apiConfiguration: The configuration for the http request. - returns: Client */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { return try await testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift index 7127e038bd30..111b92ae26c7 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift @@ -16,7 +16,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -57,7 +56,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute().body } @@ -110,7 +108,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: [Pet] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [Pet] { return try await findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute().body } @@ -155,7 +152,6 @@ open class PetAPI { - returns: Set */ @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: Set, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Set { return try await findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute().body } @@ -200,7 +196,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Pet */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Pet { return try await getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute().body } @@ -244,7 +239,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -286,7 +280,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute().body } @@ -339,7 +332,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute().body } @@ -392,7 +384,6 @@ open class PetAPI { - parameter apiConfiguration: The configuration for the http request. - returns: ApiResponse */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift index 06e30274cec6..7688e9f4456b 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -16,7 +16,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } @@ -56,7 +55,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: [String: Int] */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [String: Int] { return try await getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } @@ -96,7 +94,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { return try await getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } @@ -137,7 +134,6 @@ open class StoreAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Order */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { return try await placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift index bb05d9be0a52..27c4877f4bfb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift @@ -16,7 +16,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -54,7 +53,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -91,7 +89,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } @@ -128,7 +125,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } @@ -169,7 +165,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: User */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> User { return try await getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } @@ -210,7 +205,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: String */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> String { return try await loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute().body } @@ -252,7 +246,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } @@ -289,7 +282,6 @@ open class UserAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Void */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { return try await updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift index 1d94b12a8166..89dc30b72299 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,21 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + #if compiler(>=6.2) + @concurrent @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +111,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +128,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +141,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift index 43c83629acd6..269f99f90199 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift index a9ae02be7735..4c806a5dcfd0 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift index 94679ba5af85..eaf441b4c31e 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift @@ -55,5 +55,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 0fdd3164dc02..c577d162a3c1 100644 --- a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -322,7 +322,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -373,7 +373,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -388,7 +388,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -403,7 +403,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -418,7 +418,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -435,7 +435,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/objcCompatible/Package.swift b/samples/client/petstore/swift6/objcCompatible/Package.swift index 0c83fdb87472..12cadf5a51e4 100644 --- a/samples/client/petstore/swift6/objcCompatible/Package.swift +++ b/samples/client/petstore/swift6/objcCompatible/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/objcCompatible/PetstoreClient.podspec b/samples/client/petstore/swift6/objcCompatible/PetstoreClient.podspec index a438db340972..73466e6b7964 100644 --- a/samples/client/petstore/swift6/objcCompatible/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/objcCompatible/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 67363bd51bb6..7e8bbecc09d2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class AdditionalPropertiesClass: NSObject, Codable { +@objcMembers public final class AdditionalPropertiesClass: NSObject, Codable, @unchecked Sendable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift index 73979b9c7dfa..5452a85517eb 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Animal: NSObject, Codable { +@objcMembers public final class Animal: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift index 99c3cc011f9a..cf1e3d206d31 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ApiResponse: NSObject, Codable { +@objcMembers public final class ApiResponse: NSObject, Codable, @unchecked Sendable { public var code: Int? public var codeNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index d99f7676974d..4ece3604ea54 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfArrayOfNumberOnly: NSObject, Codable { +@objcMembers public final class ArrayOfArrayOfNumberOnly: NSObject, Codable, @unchecked Sendable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index 8995bbdf2d72..67b719892002 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfNumberOnly: NSObject, Codable { +@objcMembers public final class ArrayOfNumberOnly: NSObject, Codable, @unchecked Sendable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift index 03e4b517b264..9d44d508ca2d 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayTest: NSObject, Codable { +@objcMembers public final class ArrayTest: NSObject, Codable, @unchecked Sendable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift index c37099bfb486..67b0a829c450 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Capitalization: NSObject, Codable { +@objcMembers public final class Capitalization: NSObject, Codable, @unchecked Sendable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift index 4c5ac7fbc90a..348917b88da0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Cat: NSObject, Codable { +@objcMembers public final class Cat: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift index 96fcaff3d401..a015f83a5f66 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Category: NSObject, Codable { +@objcMembers public final class Category: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift index 4978f212ac10..20b9477b854c 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -@objcMembers public class ClassModel: NSObject, Codable { +@objcMembers public final class ClassModel: NSObject, Codable, @unchecked Sendable { public var _class: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift index dbad08f4cee0..b0ffa2ecadf6 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Client: NSObject, Codable { +@objcMembers public final class Client: NSObject, Codable, @unchecked Sendable { public var client: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift index 972028f8d87b..939a335abed5 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Dog: NSObject, Codable { +@objcMembers public final class Dog: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift index 93e9af26ba6a..6b5295f71777 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumArrays: NSObject, Codable { +@objcMembers public final class EnumArrays: NSObject, Codable, @unchecked Sendable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift index ecefb6644fb2..3f16a5a51fe1 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumTest: NSObject, Codable { +@objcMembers public final class EnumTest: NSObject, Codable, @unchecked Sendable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift index c8cb3ec9ca5a..3236733b5b24 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -@objcMembers public class File: NSObject, Codable { +@objcMembers public final class File: NSObject, Codable, @unchecked Sendable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 678e7dc717e2..e10083a40ba9 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FileSchemaTestClass: NSObject, Codable { +@objcMembers public final class FileSchemaTestClass: NSObject, Codable, @unchecked Sendable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift index 2a229371bf2e..f93c182df2f3 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FormatTest: NSObject, Codable { +@objcMembers public final class FormatTest: NSObject, Codable, @unchecked Sendable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index 5539b28b047e..37cb9878d4aa 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class HasOnlyReadOnly: NSObject, Codable { +@objcMembers public final class HasOnlyReadOnly: NSObject, Codable, @unchecked Sendable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift index 437e6e295793..431f13917f87 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class List: NSObject, Codable { +@objcMembers public final class List: NSObject, Codable, @unchecked Sendable { public var _123list: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift index 9a3a4c6f0ab9..2639df5a7711 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MapTest: NSObject, Codable { +@objcMembers public final class MapTest: NSObject, Codable, @unchecked Sendable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 3c209dadf694..9db6a8e59a18 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable { +@objcMembers public final class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, @unchecked Sendable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift index 01417dc973db..4cf09f3d1aec 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -@objcMembers public class Model200Response: NSObject, Codable { +@objcMembers public final class Model200Response: NSObject, Codable, @unchecked Sendable { public var name: Int? public var nameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift index ea194f23abe9..9d1b18bc6159 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -@objcMembers public class Name: NSObject, Codable { +@objcMembers public final class Name: NSObject, Codable, @unchecked Sendable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift index 0bf7187db5ab..23145cf57472 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class NumberOnly: NSObject, Codable { +@objcMembers public final class NumberOnly: NSObject, Codable, @unchecked Sendable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift index 0a73b6782855..40c33e727967 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Order: NSObject, Codable { +@objcMembers public final class Order: NSObject, Codable, @unchecked Sendable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift index 6eecc41fd8b2..7f507d7248fc 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class OuterComposite: NSObject, Codable { +@objcMembers public final class OuterComposite: NSObject, Codable, @unchecked Sendable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift index f41187772fb9..70698fc0136a 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Pet: NSObject, Codable { +@objcMembers public final class Pet: NSObject, Codable, @unchecked Sendable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index e7df6a5b1164..0663e2751ff0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ReadOnlyFirst: NSObject, Codable { +@objcMembers public final class ReadOnlyFirst: NSObject, Codable, @unchecked Sendable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift index d832278eb61f..7058ae9ba6e7 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -@objcMembers public class Return: NSObject, Codable { +@objcMembers public final class Return: NSObject, Codable, @unchecked Sendable { public var _return: Int? public var _returnNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift index 33a6e621028c..6a83870af31b 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class SpecialModelName: NSObject, Codable { +@objcMembers public final class SpecialModelName: NSObject, Codable, @unchecked Sendable { public var specialPropertyName: Int64? public var specialPropertyNameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift index a3240d3e3724..e94fc01c4555 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class StringBooleanMap: NSObject, Codable { +@objcMembers public final class StringBooleanMap: NSObject, Codable, @unchecked Sendable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift index 51a4111dbce4..bc2ad89a9040 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Tag: NSObject, Codable { +@objcMembers public final class Tag: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift index c5f3a002a8ad..4c9656ad6904 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderDefault: NSObject, Codable { +@objcMembers public final class TypeHolderDefault: NSObject, Codable, @unchecked Sendable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift index 36ddbd26f366..bac63f74c5cd 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderExample: NSObject, Codable { +@objcMembers public final class TypeHolderExample: NSObject, Codable, @unchecked Sendable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift index 434186d6edb2..c93aa17cc872 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class User: NSObject, Codable { +@objcMembers public final class User: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/oneOf/Package.swift b/samples/client/petstore/swift6/oneOf/Package.swift index dc5bc46564c7..72355e07f87c 100644 --- a/samples/client/petstore/swift6/oneOf/Package.swift +++ b/samples/client/petstore/swift6/oneOf/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient.podspec b/samples/client/petstore/swift6/oneOf/PetstoreClient.podspec index 2dec3a8ecf9a..63771b4da439 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '0.0.1' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v0.0.1' } s.authors = '' diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index e3a1fd2b8380..2aa84c29d112 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/promisekitLibrary/Package.swift b/samples/client/petstore/swift6/promisekitLibrary/Package.swift index efc43e9be1d0..2c21ed517d25 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/Package.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient.podspec index fa038ff7ce5c..ffddaf37d74d 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index f1e6635eb979..d382fbab9106 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -321,7 +321,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -374,7 +374,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -390,7 +390,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -405,7 +405,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -420,7 +420,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -437,7 +437,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/resultLibrary/Package.swift b/samples/client/petstore/swift6/resultLibrary/Package.swift index dc5bc46564c7..72355e07f87c 100644 --- a/samples/client/petstore/swift6/resultLibrary/Package.swift +++ b/samples/client/petstore/swift6/resultLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/resultLibrary/PetstoreClient.podspec index d5b8cefeffa0..ca2fc21a4068 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index f576985cdd7e..6a86fc03d8f6 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -internal struct APIHelper { +internal struct APIHelper: Sendable { internal static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 15d7a5af2665..fc4bec788267 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ internal class PetstoreClientAPIConfiguration: @unchecked Sendable { internal static let shared = PetstoreClientAPIConfiguration() } -internal class RequestBuilder: @unchecked Sendable, Identifiable { +internal class RequestBuilder: @unchecked Sendable, Identifiable { internal var credential: URLCredential? internal var headers: [String: String] internal let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ internal class RequestBuilder: @unchecked Sendable, Identifiable { } } -internal protocol RequestBuilderFactory { +internal protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 0f7fca84583b..d7086fdd4de4 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -internal enum ErrorResponse: Error { +internal enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -internal enum DownloadException: Error { +internal enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ internal enum DownloadException: Error { case requestMissingURL } -internal enum DecodableRequestBuilderError: Error { +internal enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index ac134522359d..53841c2b711f 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -internal class URLSessionRequestBuilderFactory: RequestBuilderFactory { +internal final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { internal init() {} internal func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required internal init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab } -internal class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +internal class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ internal class URLSessionDecodableRequestBuilder: URLSessionReques try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ internal class URLSessionDecodableRequestBuilder: URLSessionReques switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ internal enum OpenAPIInterceptorRetry { case dontRetry } -internal protocol OpenAPIInterceptor { +internal protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +internal extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -internal class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +internal final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index 38e3460f565e..c52c511100ea 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ internal struct ArrayRule: Sendable { internal var uniqueItems: Bool } -internal enum StringValidationErrorKind: Error { +internal enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -internal enum NumericValidationErrorKind: Error { +internal enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -internal enum ArrayValidationErrorKind: Error { +internal enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -internal struct ValidationError: Error { +internal struct ValidationError: Error, Sendable { internal fileprivate(set) var kinds: Set } -internal struct Validator { +internal struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 518c5fad933d..3441fd84e9f8 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -32,5 +32,4 @@ internal struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index d794422d7b85..013c50f5f44b 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -55,5 +55,4 @@ internal struct Order: Sendable, Codable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 836a2387b090..68dcc5b859f5 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -58,5 +58,4 @@ internal struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 08d6b28b9ef0..e57e2613321d 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -32,5 +32,4 @@ internal struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index 3664e7153bb9..295ee291b4a3 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -57,5 +57,4 @@ internal struct User: Sendable, Codable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/Package.swift b/samples/client/petstore/swift6/rxswiftLibrary/Package.swift index 378f1f5691f3..4d7097939163 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/Package.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient.podspec index 3731fc0afde1..242724e27117 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 64f4cbd29125..1d65d00009e1 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -32,5 +32,4 @@ public struct Category: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index bf2137d27a16..79047bcea53c 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -54,5 +54,4 @@ public struct Order: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 5e9084ec2ef2..90542764c14a 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -57,5 +57,4 @@ public struct Pet: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 510c09ab0201..98c4ba422c17 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -32,5 +32,4 @@ public struct Tag: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f012dafe19c6..2d7e6d82b18a 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -57,5 +57,4 @@ public struct User: Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index ef8ab32693c6..1cbfba62b5b7 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -323,7 +323,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -374,7 +374,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -389,7 +389,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -405,7 +405,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -422,7 +422,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -441,7 +441,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/swift6_test_all.sh b/samples/client/petstore/swift6/swift6_test_all.sh index 55bde1c8754d..960e0e0e25d9 100755 --- a/samples/client/petstore/swift6/swift6_test_all.sh +++ b/samples/client/petstore/swift6/swift6_test_all.sh @@ -12,20 +12,20 @@ DIRECTORY=`dirname $0` (cd $DIRECTORY/default/ && ./run_spmbuild.sh) (cd $DIRECTORY/objcCompatible/ && ./run_spmbuild.sh) (cd $DIRECTORY/oneOf/ && ./run_spmbuild.sh) -# (cd $DIRECTORY/promisekitLibrary/ && ./run_spmbuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/promisekitLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/resultLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/rxswiftLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/urlsessionLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/validation/ && ./run_spmbuild.sh) -# (cd $DIRECTORY/vaporLibrary/ && ./run_spmbuild.sh) # Commented because it's not working +(cd $DIRECTORY/vaporLibrary/ && ./run_spmbuild.sh) # example project with unit tests (cd $DIRECTORY/alamofireLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/apiNonStaticMethod/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/asyncAwaitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) -# (cd $DIRECTORY/combineLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/combineLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/combineDeferredLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/default/SwaggerClientTests/ && ./run_xcodebuild.sh) -# (cd $DIRECTORY/promisekitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/promisekitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/rxswiftLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/urlsessionLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Package.swift b/samples/client/petstore/swift6/urlsessionLibrary/Package.swift index 0c83fdb87472..12cadf5a51e4 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Package.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/urlsessionLibrary/PetstoreClient.podspec b/samples/client/petstore/swift6/urlsessionLibrary/PetstoreClient.podspec index a438db340972..73466e6b7964 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/urlsessionLibrary/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '1.0.0' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } s.authors = '' diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index 5483a1487591..6c19df9add1e 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -49,7 +49,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -97,7 +97,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift index 6214d1c4ae60..3dfbe54660ca 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift @@ -50,5 +50,4 @@ public final class Category: @unchecked Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension PetstoreClientAPI.Category: Identifiable {} diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift index b6099721780b..51955bac3e09 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift @@ -80,5 +80,4 @@ public final class Order: @unchecked Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension PetstoreClientAPI.Order: Identifiable {} diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift index 12897bc44ff0..e53bbe2a464d 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -83,5 +83,4 @@ public final class Pet: @unchecked Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension PetstoreClientAPI.Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift index 98727c593bf2..57191b9a431f 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -50,5 +50,4 @@ public final class Tag: @unchecked Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension PetstoreClientAPI.Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift index 3447b1a8fe26..c7cc92d11ea8 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift @@ -87,5 +87,4 @@ public final class User: @unchecked Sendable, Codable, Hashable { } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension PetstoreClientAPI.User: Identifiable {} diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 83e40f99b2ba..82a415970b7b 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -377,7 +377,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -392,7 +392,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -407,7 +407,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SwaggerClient/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -422,7 +422,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -439,7 +439,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = SwaggerClientTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift index f15a53536d37..6c9307558377 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift @@ -9,7 +9,7 @@ import Foundation import PetstoreClient -public class BearerOpenAPIInterceptor: OpenAPIInterceptor { +public final class BearerOpenAPIInterceptor: OpenAPIInterceptor { public init() {} public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @escaping (Result) -> Void) { @@ -54,7 +54,12 @@ public class BearerOpenAPIInterceptor: OpenAPIInterceptor { } } - private var bearerToken: String? = nil + private let lock = NSRecursiveLock() + nonisolated(unsafe) private var _bearerToken: String? = nil + private var bearerToken: String? { + get { lock.withLock { _bearerToken } } + set { lock.withLock { _bearerToken = newValue } } + } func refreshTokenIfDoesntExist(completionHandler: @escaping (String) -> Void) { if let bearerToken = bearerToken { diff --git a/samples/client/petstore/swift6/validation/Package.swift b/samples/client/petstore/swift6/validation/Package.swift index dc5bc46564c7..72355e07f87c 100644 --- a/samples/client/petstore/swift6/validation/Package.swift +++ b/samples/client/petstore/swift6/validation/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "PetstoreClient", platforms: [ - .iOS(.v12), - .macOS(.v10_13), - .tvOS(.v12), - .watchOS(.v4), + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/samples/client/petstore/swift6/validation/PetstoreClient.podspec b/samples/client/petstore/swift6/validation/PetstoreClient.podspec index 2dec3a8ecf9a..63771b4da439 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient.podspec +++ b/samples/client/petstore/swift6/validation/PetstoreClient.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = 'PetstoreClient' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '4.0' + s.ios.deployment_target = '13.0' + s.osx.deployment_target = '10.15' + s.tvos.deployment_target = '13.0' + s.watchos.deployment_target = '6.0' s.version = '0.0.1' s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v0.0.1' } s.authors = '' diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift index 3ac2200c3a62..406e2d781e94 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift @@ -14,7 +14,6 @@ open class DefaultAPI { - parameter apiConfiguration: The configuration for the http request. - returns: Banana */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func rootGet(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Banana { return try await rootGetWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 98c27f3af422..e7d8bacb8197 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,21 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + #if compiler(>=6.2) + @concurrent @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +111,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +128,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +141,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..f7a9f4f40195 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..30cff02eb977 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -157,6 +157,8 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { let dataTask = urlSession.dataTaskFromProtocol(with: modifiedRequest) { data, response, error in self.cleanupRequest() + self.apiConfiguration.interceptor.didReceiveResponse(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) + if let error = error { self.retryRequest( urlRequest: modifiedRequest, @@ -196,7 +198,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - self.processRequestResponse(urlRequest: request, data: data, httpResponse: httpResponse, error: error, completion: completion) + self.processRequestResponse(urlRequest: modifiedRequest, urlSession: urlSession, data: data, httpResponse: httpResponse, error: error, completion: completion) } self.onProgressReady?(dataTask.progress) @@ -205,15 +207,25 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.requestTask.set(task: dataTask) + self.apiConfiguration.interceptor.willSendRequest(urlRequest: modifiedRequest, urlSession: urlSession, requestBuilder: self) + dataTask.resume() case .failure(let error): + self.apiConfiguration.interceptor.didComplete(urlRequest: request, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { + // Request creation failed - create a minimal request for error reporting + let failedURL = URL(string: URLString) ?? URL(string: "about:blank")! + var failedRequest = URLRequest(url: failedURL) + failedRequest.httpMethod = method + + self.apiConfiguration.interceptor.didComplete(urlRequest: failedRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: nil, result: .failure(error)) + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } @@ -235,6 +247,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { self.execute(completion: completion) case .dontRetry: + self.apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, result: .failure(error)) self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } @@ -242,12 +255,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: fatalError("Unsupported Response Body Type - \(String(describing: T.self))") @@ -319,19 +333,17 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { + override fileprivate func processRequestResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { case is String.Type: - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(body as! T)) completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) case is URL.Type: do { - guard error == nil else { throw DownloadException.responseFailed } @@ -358,29 +370,37 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(filePath as! T)) completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) } catch let requestParserError as DownloadException { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(requestParserError)) completion(.failure(ErrorResponse.error(400, data, httpResponse, requestParserError))) } catch { + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(400, data, httpResponse, error))) } case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + let result = () as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + let result = data as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) default: - guard let unwrappedData = data, !unwrappedData.isEmpty else { if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) + let result = expressibleByNilLiteralType.init(nilLiteral: ()) as! T + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: httpResponse, result: .success(result)) + completion(.success(Response(response: httpResponse, body: result, bodyData: data))) } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, DecodableRequestBuilderError.emptyDataResponse))) + let emptyDataError = DecodableRequestBuilderError.emptyDataResponse + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: nil, response: httpResponse, result: .failure(emptyDataError)) + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, httpResponse, emptyDataError))) } return } @@ -389,8 +409,10 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui switch decodeResult { case let .success(decodableObj): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .success(decodableObj)) completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) case let .failure(error): + apiConfiguration.interceptor.didComplete(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: unwrappedData, response: httpResponse, result: .failure(error)) completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, httpResponse, error))) } } @@ -711,19 +733,47 @@ public enum OpenAPIInterceptorRetry { case dontRetry } -public protocol OpenAPIInterceptor { +public protocol OpenAPIInterceptor: Sendable { + // MARK: - Request Modification & Retry + + /// Called before the request is sent. Allows modifying the URLRequest (e.g., adding authentication headers). func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) + /// Called when a request fails. Allows the interceptor to decide whether to retry the request. func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) + + // MARK: - Lifecycle Hooks + + /// Called right before the request is sent, after all modifications from `intercept()` have been applied. + /// Useful for logging the final request that will be sent. + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) + + /// Called when the raw response is received, before any processing or decoding. + /// Useful for logging raw responses or performing custom validation. + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) + + /// Called after the request completes (either success or failure). + /// Useful for cleanup, analytics, or performance monitoring. + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) +} + +// MARK: - Default Implementations (No-op) + +public extension OpenAPIInterceptor { + func willSendRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder) {} + + func didReceiveResponse(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error?) {} + + func didComplete(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, result: Result) {} } -public class DefaultOpenAPIInterceptor: OpenAPIInterceptor { +public final class DefaultOpenAPIInterceptor: OpenAPIInterceptor { public init() {} - + public func intercept(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, completion: @Sendable @escaping (Result) -> Void) { completion(.success(urlRequest)) } - + public func retry(urlRequest: URLRequest, urlSession: URLSessionProtocol, requestBuilder: RequestBuilder, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (OpenAPIInterceptorRetry) -> Void) { completion(.dontRetry) } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/vaporLibrary/Package.resolved b/samples/client/petstore/swift6/vaporLibrary/Package.resolved index 43abc9ffe932..98da6fb9097e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Package.resolved +++ b/samples/client/petstore/swift6/vaporLibrary/Package.resolved @@ -1,22 +1,13 @@ { - "originHash" : "304d1886957f380ef5bd7f0063626a4f4aba90401e7b7bdb7cc76683c6164046", + "originHash" : "c50d0dfe7c1a62afbc27f4524644bf3c0d5fabf878c0b98e4d5036ac1163b38d", "pins" : [ - { - "identity" : "anycodable", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Flight-School/AnyCodable", - "state" : { - "revision" : "862808b2070cd908cb04f9aafe7de83d35f81b05", - "version" : "0.6.7" - } - }, { "identity" : "async-http-client", "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/async-http-client.git", "state" : { - "revision" : "8e4d51908dd49272667126403bf977c5c503f78f", - "version" : "1.5.0" + "revision" : "4b99975677236d13f0754339864e5360142ff5a1", + "version" : "1.30.3" } }, { @@ -24,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/async-kit.git", "state" : { - "revision" : "c1de408100a2f2e4ab2ea06512e8635bc1a59144", - "version" : "1.3.1" + "revision" : "6f3615ccf2ac3c2ae0c8087d527546e9544a43dd", + "version" : "1.21.0" } }, { @@ -33,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/console-kit.git", "state" : { - "revision" : "cfe8bcd58f74ffecb4f536d8237de146b634ecd3", - "version" : "4.2.6" + "revision" : "742f624a998cba2a9e653d9b1e91ad3f3a5dff6b", + "version" : "4.15.2" } }, { @@ -42,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/multipart-kit.git", "state" : { - "revision" : "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", - "version" : "4.2.1" + "revision" : "3498e60218e6003894ff95192d756e238c01f44e", + "version" : "4.7.1" } }, { @@ -51,17 +42,62 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/routing-kit.git", "state" : { - "revision" : "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", - "version" : "4.3.0" + "revision" : "1a10ccea61e4248effd23b6e814999ce7bdf0ee0", + "version" : "4.9.3" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "810496cf121e525d660cd0ea89a758740476b85f", + "version" : "1.5.1" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "6c050d5ef8e1aa6342528460db614e9770d7f804", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" } }, { - "identity" : "swift-backtrace", + "identity" : "swift-certificates", "kind" : "remoteSourceControl", - "location" : "https://github.com/swift-server/swift-backtrace.git", + "location" : "https://github.com/apple/swift-certificates.git", "state" : { - "revision" : "54a65d6391a1467a896d0d351ff2de6f469ee53c", - "version" : "1.2.3" + "revision" : "7d5f6124c91a2d06fb63a811695a3400d15a100e", + "version" : "1.17.1" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" } }, { @@ -69,8 +105,35 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", - "version" : "1.1.6" + "revision" : "6f70fa9eab24c1fd982af18c281c4525d05e3095", + "version" : "4.2.0" + } + }, + { + "identity" : "swift-distributed-tracing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-distributed-tracing.git", + "state" : { + "revision" : "baa932c1336f7894145cbaafcd34ce2dd0b77c97", + "version" : "1.3.1" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "76d7627bd88b47bf5a0f8497dd244885960dde0b", + "version" : "1.6.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "45eb0224913ea070ec4fba17291b9e7ecf4749ca", + "version" : "1.5.1" } }, { @@ -78,8 +141,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", - "version" : "1.4.2" + "revision" : "2778fd4e5a12a8aaa30a3ee8285f4ce54c5f3181", + "version" : "1.9.1" } }, { @@ -87,8 +150,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-metrics.git", "state" : { - "revision" : "e382458581b05839a571c578e90060fff499f101", - "version" : "2.1.1" + "revision" : "0743a9364382629da3bf5677b46a2c4b1ce5d2a6", + "version" : "2.7.1" } }, { @@ -96,8 +159,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "d79e33308b0ac83326b0ead0ea6446e604b8162d", - "version" : "2.30.0" + "revision" : "233f61bc2cfbb22d0edeb2594da27a20d2ce514e", + "version" : "2.93.0" } }, { @@ -105,8 +168,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-extras.git", "state" : { - "revision" : "f72c4688f89c28502105509186eadc49a49cb922", - "version" : "1.10.0" + "revision" : "cc599775aa85d04340f09b47e5432564f9889ae7", + "version" : "1.32.0" } }, { @@ -114,8 +177,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "13b6a7a83864005334818d7ea2a3053869a96c04", - "version" : "1.18.0" + "revision" : "c2ba4cfbb83f307c66f5a6df6bb43e3c88dfbf80", + "version" : "1.39.0" } }, { @@ -123,8 +186,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-ssl.git", "state" : { - "revision" : "9db7cee4b62c39160a6bd513a47a1ecdcceac18a", - "version" : "2.14.0" + "revision" : "173cc69a058623525a58ae6710e2f5727c663793", + "version" : "2.36.0" } }, { @@ -132,8 +195,44 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "39587bceccda72780e2a8a8c5e857e42a9df2fa8", - "version" : "1.11.0" + "revision" : "60c3e187154421171721c1a38e800b390680fb5d", + "version" : "1.26.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-service-context", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-service-context.git", + "state" : { + "revision" : "1983448fefc717a2bc2ebde5490fe99873c5b8a6", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "1de37290c0ab3c5a96028e0f02911b672fd42348", + "version" : "2.9.1" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "7c6ad0fc39d0763e0b699210e4124afd5041c5df", + "version" : "1.6.4" } }, { @@ -141,8 +240,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/vapor", "state" : { - "revision" : "086d0b80f2c3623ffd6b5e32b964ad00b67c2e90", - "version" : "4.47.1" + "revision" : "6f3db7122ccffb28e11e121c3797a176fcb88796", + "version" : "4.121.1" } }, { @@ -150,8 +249,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/websocket-kit.git", "state" : { - "revision" : "a2d26b3de8b3be292f3208d1c74024f76ac503da", - "version" : "2.1.3" + "revision" : "8666c92dbbb3c8eefc8008c9c8dcf50bfd302167", + "version" : "2.16.1" } } ], diff --git a/samples/client/petstore/swift6/vaporLibrary/Package.swift b/samples/client/petstore/swift6/vaporLibrary/Package.swift index 5f2d61faba90..830841275040 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Package.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Package.swift @@ -16,14 +16,14 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/vapor/vapor", from: "4.0.0") + .package(url: "https://github.com/vapor/vapor", from: "4.99.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "PetstoreClient", - dependencies: ["Vapor", ], + dependencies: [.product(name: "Vapor", package: "vapor")], path: "Sources/PetstoreClient" ), ], diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 490594e67bbe..1900176b6f1d 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -18,7 +18,7 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/another-fake/dummy" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -26,8 +26,8 @@ open class AnotherFakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "uuid_test", value: uuidTest.description) @@ -51,8 +51,8 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `Call123testSpecialTags` */ - open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return call123testSpecialTagsRaw(uuidTest: uuidTest, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> Call123testSpecialTags in + open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return call123testSpecialTagsRaw(uuidTest: uuidTest, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> Call123testSpecialTags in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 480dc61d468e..649edd9863b4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -17,7 +17,7 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/create_xml_item" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -25,8 +25,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(xmlItem, using: apiConfiguration.contentConfiguration.requireEncoder(for: XmlItem.defaultContentType)) @@ -47,8 +47,8 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `CreateXmlItem` */ - open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createXmlItemRaw(xmlItem: xmlItem, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateXmlItem in + open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createXmlItemRaw(xmlItem: xmlItem, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateXmlItem in switch response.status.code { case 200: return .http200(raw: response) @@ -64,7 +64,7 @@ open class FakeAPI { - parameter body: (body) Input boolean as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterBooleanSerializeRaw(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterBooleanSerializeRaw(body: Bool? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/boolean" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -72,8 +72,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -95,8 +95,8 @@ open class FakeAPI { - parameter body: (body) Input boolean as post body (optional) - returns: `EventLoopFuture` of `FakeOuterBooleanSerialize` */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterBooleanSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterBooleanSerialize in + open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterBooleanSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterBooleanSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(Bool.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Bool.defaultContentType)), raw: response) @@ -112,7 +112,7 @@ open class FakeAPI { - parameter body: (body) Input composite as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterCompositeSerializeRaw(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterCompositeSerializeRaw(body: OuterComposite? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/composite" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -120,8 +120,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -143,8 +143,8 @@ open class FakeAPI { - parameter body: (body) Input composite as post body (optional) - returns: `EventLoopFuture` of `FakeOuterCompositeSerialize` */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterCompositeSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterCompositeSerialize in + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterCompositeSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterCompositeSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(OuterComposite.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: OuterComposite.defaultContentType)), raw: response) @@ -160,7 +160,7 @@ open class FakeAPI { - parameter body: (body) Input number as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterNumberSerializeRaw(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterNumberSerializeRaw(body: Double? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/number" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -168,8 +168,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -191,8 +191,8 @@ open class FakeAPI { - parameter body: (body) Input number as post body (optional) - returns: `EventLoopFuture` of `FakeOuterNumberSerialize` */ - open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterNumberSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterNumberSerialize in + open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterNumberSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterNumberSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(Double.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Double.defaultContentType)), raw: response) @@ -208,7 +208,7 @@ open class FakeAPI { - parameter body: (body) Input string as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterStringSerializeRaw(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterStringSerializeRaw(body: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/string" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -216,8 +216,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -239,8 +239,8 @@ open class FakeAPI { - parameter body: (body) Input string as post body (optional) - returns: `EventLoopFuture` of `FakeOuterStringSerialize` */ - open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterStringSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterStringSerialize in + open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterStringSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterStringSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) @@ -256,7 +256,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-file-schema" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -264,8 +264,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: FileSchemaTestClass.defaultContentType)) @@ -285,8 +285,8 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithFileSchema` */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testBodyWithFileSchemaRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithFileSchema in + open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testBodyWithFileSchemaRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithFileSchema in switch response.status.code { case 200: return .http200(raw: response) @@ -302,7 +302,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-query-params" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -310,8 +310,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var query: String @@ -338,8 +338,8 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithQueryParams` */ - open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testBodyWithQueryParamsRaw(query: query, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithQueryParams in + open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testBodyWithQueryParamsRaw(query: query, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithQueryParams in switch response.status.code { case 200: return .http200(raw: response) @@ -356,7 +356,7 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClientModelRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClientModelRaw(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -364,8 +364,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) @@ -386,8 +386,8 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClientModel` */ - open class func testClientModel(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testClientModelRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestClientModel in + open class func testClientModel(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testClientModelRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestClientModel in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) @@ -420,7 +420,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testEndpointParametersRaw(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testEndpointParametersRaw(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -428,8 +428,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -483,8 +483,8 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: `EventLoopFuture` of `TestEndpointParameters` */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testEndpointParametersRaw(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestEndpointParameters in + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testEndpointParametersRaw(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestEndpointParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -577,7 +577,7 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testEnumParametersRaw(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testEnumParametersRaw(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -585,8 +585,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "enum_header_string_array", value: enumHeaderStringArray?.map { $0.rawValue.description }.description ?? "") @@ -636,8 +636,8 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: `EventLoopFuture` of `TestEnumParameters` */ - open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testEnumParametersRaw(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestEnumParameters in + open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testEnumParametersRaw(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestEnumParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -661,7 +661,7 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testGroupParametersRaw(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testGroupParametersRaw(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -669,8 +669,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "required_boolean_group", value: requiredBooleanGroup.description) @@ -712,8 +712,8 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: `EventLoopFuture` of `TestGroupParameters` */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testGroupParametersRaw(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestGroupParameters in + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testGroupParametersRaw(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestGroupParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -729,7 +729,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/inline-additionalProperties" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -737,8 +737,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(param, using: apiConfiguration.contentConfiguration.requireEncoder(for: [String: String].defaultContentType)) @@ -758,8 +758,8 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `TestInlineAdditionalProperties` */ - open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testInlineAdditionalPropertiesRaw(param: param, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestInlineAdditionalProperties in + open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testInlineAdditionalPropertiesRaw(param: param, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestInlineAdditionalProperties in switch response.status.code { case 200: return .http200(raw: response) @@ -776,7 +776,7 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -784,8 +784,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -810,8 +810,8 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `TestJsonFormData` */ - open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testJsonFormDataRaw(param: param, param2: param2, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestJsonFormData in + open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testJsonFormDataRaw(param: param, param2: param2, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestJsonFormData in switch response.status.code { case 200: return .http200(raw: response) @@ -831,7 +831,7 @@ open class FakeAPI { - parameter context: (query) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testQueryParameterCollectionFormatRaw(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testQueryParameterCollectionFormatRaw(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/test-query-parameters" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -839,8 +839,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var pipe: [String] @@ -878,8 +878,8 @@ open class FakeAPI { - parameter context: (query) - returns: `EventLoopFuture` of `TestQueryParameterCollectionFormat` */ - open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testQueryParameterCollectionFormatRaw(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestQueryParameterCollectionFormat in + open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testQueryParameterCollectionFormatRaw(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestQueryParameterCollectionFormat in switch response.status.code { case 200: return .http200(raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 793f6a370ed2..352c9326d0ee 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClassnameRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClassnameRaw(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake_classname_test" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -28,8 +28,8 @@ open class FakeClassnameTags123API { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) @@ -53,8 +53,8 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClassname` */ - open class func testClassname(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testClassnameRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestClassname in + open class func testClassname(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testClassnameRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestClassname in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index e3e6be3bf6d9..70e8d3407a36 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -19,7 +19,7 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `ClientResponse` */ - open class func addPetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func addPetRaw(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -27,8 +27,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) @@ -52,8 +52,8 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `AddPet` */ - open class func addPet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return addPetRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> AddPet in + open class func addPet(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return addPetRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> AddPet in switch response.status.code { case 200: return .http200(raw: response) @@ -75,7 +75,7 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -86,8 +86,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "api_key", value: apiKey?.description ?? "") @@ -113,8 +113,8 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `DeletePet` */ - open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deletePetRaw(petId: petId, apiKey: apiKey, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeletePet in + open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deletePetRaw(petId: petId, apiKey: apiKey, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeletePet in switch response.status.code { case 200: return .http200(raw: response) @@ -145,7 +145,7 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: `EventLoopFuture` of `ClientResponse` */ - open class func findPetsByStatusRaw(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByStatusRaw(status: [Status_findPetsByStatus], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByStatus" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -153,8 +153,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var status: [Status_findPetsByStatus] @@ -185,8 +185,8 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: `EventLoopFuture` of `FindPetsByStatus` */ - open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return findPetsByStatusRaw(status: status, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByStatus in + open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return findPetsByStatusRaw(status: status, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByStatus in switch response.status.code { case 200: return .http200(value: try response.content.decode([Pet].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [Pet].defaultContentType)), raw: response) @@ -209,7 +209,7 @@ open class PetAPI { - returns: `EventLoopFuture` of `ClientResponse` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByTags" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -217,8 +217,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var tags: Set @@ -250,8 +250,8 @@ open class PetAPI { - returns: `EventLoopFuture` of `FindPetsByTags` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return findPetsByTagsRaw(tags: tags, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByTags in + open class func findPetsByTags(tags: Set, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return findPetsByTagsRaw(tags: tags, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByTags in switch response.status.code { case 200: return .http200(value: try response.content.decode(Set.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Set.defaultContentType)), raw: response) @@ -273,7 +273,7 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -284,8 +284,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -310,8 +310,8 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `GetPetById` */ - open class func getPetById(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getPetByIdRaw(petId: petId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetPetById in + open class func getPetById(petId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getPetByIdRaw(petId: petId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetPetById in switch response.status.code { case 200: return .http200(value: try response.content.decode(Pet.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Pet.defaultContentType)), raw: response) @@ -334,7 +334,7 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updatePetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetRaw(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -342,8 +342,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) @@ -369,8 +369,8 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `UpdatePet` */ - open class func updatePet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updatePetRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePet in + open class func updatePet(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updatePetRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePet in switch response.status.code { case 200: return .http200(raw: response) @@ -397,7 +397,7 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updatePetWithFormRaw(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetWithFormRaw(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -408,8 +408,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -438,8 +438,8 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: `EventLoopFuture` of `UpdatePetWithForm` */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updatePetWithFormRaw(petId: petId, name: name, status: status, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePetWithForm in + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updatePetWithFormRaw(petId: petId, name: name, status: status, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePetWithForm in switch response.status.code { case 405: return .http405(raw: response) @@ -460,7 +460,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func uploadFileRaw(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileRaw(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -471,8 +471,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -501,8 +501,8 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: `EventLoopFuture` of `UploadFile` */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return uploadFileRaw(petId: petId, additionalMetadata: additionalMetadata, file: file, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UploadFile in + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return uploadFileRaw(petId: petId, additionalMetadata: additionalMetadata, file: file, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UploadFile in switch response.status.code { case 200: return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) @@ -523,7 +523,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func uploadFileWithRequiredFileRaw(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileWithRequiredFileRaw(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -534,8 +534,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -564,8 +564,8 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: `EventLoopFuture` of `UploadFileWithRequiredFile` */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return uploadFileWithRequiredFileRaw(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UploadFileWithRequiredFile in + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return uploadFileWithRequiredFileRaw(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UploadFileWithRequiredFile in switch response.status.code { case 200: return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 3b66f4fe05c1..8e6b7a55d3ae 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -17,7 +17,7 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deleteOrderRaw(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteOrderRaw(orderId: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -28,8 +28,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -50,8 +50,8 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: `EventLoopFuture` of `DeleteOrder` */ - open class func deleteOrder(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deleteOrderRaw(orderId: orderId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeleteOrder in + open class func deleteOrder(orderId: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deleteOrderRaw(orderId: orderId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeleteOrder in switch response.status.code { case 400: return .http400(raw: response) @@ -72,7 +72,7 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getInventoryRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getInventoryRaw(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/inventory" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -80,8 +80,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -103,8 +103,8 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `GetInventory` */ - open class func getInventory(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getInventoryRaw(headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetInventory in + open class func getInventory(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getInventoryRaw(headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetInventory in switch response.status.code { case 200: return .http200(value: try response.content.decode([String: Int].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [String: Int].defaultContentType)), raw: response) @@ -121,7 +121,7 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getOrderByIdRaw(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getOrderByIdRaw(orderId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -132,8 +132,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -155,8 +155,8 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: `EventLoopFuture` of `GetOrderById` */ - open class func getOrderById(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getOrderByIdRaw(orderId: orderId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetOrderById in + open class func getOrderById(orderId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getOrderByIdRaw(orderId: orderId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetOrderById in switch response.status.code { case 200: return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) @@ -176,7 +176,7 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `ClientResponse` */ - open class func placeOrderRaw(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func placeOrderRaw(body: Order, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/order" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -184,8 +184,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Order.defaultContentType)) @@ -206,8 +206,8 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `PlaceOrder` */ - open class func placeOrder(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return placeOrderRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> PlaceOrder in + open class func placeOrder(body: Order, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return placeOrderRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> PlaceOrder in switch response.status.code { case 200: return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 6038bfc99fcd..4f11c38a091e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -17,7 +17,7 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUserRaw(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUserRaw(body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -25,8 +25,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) @@ -46,8 +46,8 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `CreateUser` */ - open class func createUser(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUserRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUser in + open class func createUser(body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUserRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUser in switch response.status.code { default: return .http0(raw: response) @@ -61,7 +61,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithArray" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -69,8 +69,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) @@ -89,8 +89,8 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithArrayInput` */ - open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUsersWithArrayInputRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithArrayInput in + open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUsersWithArrayInputRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithArrayInput in switch response.status.code { default: return .http0(raw: response) @@ -104,7 +104,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithList" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -112,8 +112,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) @@ -132,8 +132,8 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithListInput` */ - open class func createUsersWithListInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUsersWithListInputRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithListInput in + open class func createUsersWithListInput(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUsersWithListInputRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithListInput in switch response.status.code { default: return .http0(raw: response) @@ -148,7 +148,7 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deleteUserRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteUserRaw(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -159,8 +159,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -181,8 +181,8 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: `EventLoopFuture` of `DeleteUser` */ - open class func deleteUser(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deleteUserRaw(username: username, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeleteUser in + open class func deleteUser(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deleteUserRaw(username: username, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeleteUser in switch response.status.code { case 400: return .http400(raw: response) @@ -200,7 +200,7 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getUserByNameRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getUserByNameRaw(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -211,8 +211,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -233,8 +233,8 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: `EventLoopFuture` of `GetUserByName` */ - open class func getUserByName(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getUserByNameRaw(username: username, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetUserByName in + open class func getUserByName(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getUserByNameRaw(username: username, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetUserByName in switch response.status.code { case 200: return .http200(value: try response.content.decode(User.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: User.defaultContentType)), raw: response) @@ -256,7 +256,7 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: `EventLoopFuture` of `ClientResponse` */ - open class func loginUserRaw(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func loginUserRaw(username: String, password: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/login" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -264,8 +264,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var username: String @@ -296,8 +296,8 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: `EventLoopFuture` of `LoginUser` */ - open class func loginUser(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return loginUserRaw(username: username, password: password, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> LoginUser in + open class func loginUser(username: String, password: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return loginUserRaw(username: username, password: password, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> LoginUser in switch response.status.code { case 200: return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) @@ -314,7 +314,7 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `ClientResponse` */ - open class func logoutUserRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func logoutUserRaw(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/logout" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -322,8 +322,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -340,8 +340,8 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `LogoutUser` */ - open class func logoutUser(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return logoutUserRaw(headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> LogoutUser in + open class func logoutUser(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return logoutUserRaw(headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> LogoutUser in switch response.status.code { default: return .http0(raw: response) @@ -357,7 +357,7 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -368,8 +368,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) @@ -392,8 +392,8 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `UpdateUser` */ - open class func updateUser(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updateUserRaw(username: username, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdateUser in + open class func updateUser(username: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updateUserRaw(username: username, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdateUser in switch response.status.code { case 400: return .http400(raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index b0d47e8d4738..d6f62668b5d4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -14,21 +14,21 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: HTTPHeaders public var apiClient: Vapor.Client? - public var apiWrapper: (inout Vapor.ClientRequest) throws -> () - public var contentConfiguration + public var apiWrapper: @Sendable (inout Vapor.ClientRequest) throws -> () + public var contentConfiguration: ContentConfiguration public init( basePath: String = "http://petstore.swagger.io:80/v2", customHeaders: HTTPHeaders = [:], apiClient: Vapor.Client? = nil, - apiWrapper: (inout Vapor.ClientRequest) throws -> () = { _ in }, - contentConfiguration = ContentConfiguration.default() + apiWrapper: @escaping @Sendable (inout Vapor.ClientRequest) throws -> () = { _ in }, + contentConfiguration: ContentConfiguration = ContentConfiguration.default() ) { self.basePath = basePath - customHeaders = customHeaders - apiClient = apiClient - apiWrapper = apiWrapper - contentConfiguration = contentConfiguration + self.customHeaders = customHeaders + self.apiClient = apiClient + self.apiWrapper = apiWrapper + self.contentConfiguration = contentConfiguration } public static let shared = PetstoreClientAPIConfiguration() diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift index f8b1d7f1a218..fe7303e5afc6 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -132,13 +132,11 @@ extension KeyedDecodingContainerProtocol { } -extension UUID: Content { } +extension UUID: @retroactive Content { } -extension URL: Content { } +extension URL: @retroactive Content { } -extension Bool: Content { } - -extension Set: ResponseEncodable where Element: Content { +extension Set: @retroactive ResponseEncodable where Element: Content { public func encodeResponse(for request: Vapor.Request) -> EventLoopFuture { let response = Vapor.Response() do { @@ -150,7 +148,15 @@ extension Set: ResponseEncodable where Element: Content { } } -extension Set: RequestDecodable where Element: Content { +extension Set: @retroactive AsyncResponseEncodable where Element: Content { + public func encodeResponse(for request: Vapor.Request) async throws -> Vapor.Response { + let response = Vapor.Response() + try response.content.encode(Array(self)) + return response + } +} + +extension Set: @retroactive RequestDecodable where Element: Content { public static func decodeRequest(_ request: Vapor.Request) -> EventLoopFuture { do { let content = try request.content.decode([Element].self) @@ -161,6 +167,13 @@ extension Set: RequestDecodable where Element: Content { } } -extension Set: Content where Element: Content { } +extension Set: @retroactive AsyncRequestDecodable where Element: Content { + public static func decodeRequest(_ request: Vapor.Request) async throws -> Self { + let content = try request.content.decode([Element].self) + return Set(content) + } +} + +extension Set: @retroactive Content where Element: Content { } extension JSONValue: Content {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift index 8f33cba8744e..d797849f9a6c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesAnyType: Content, Hashable { +public struct AdditionalPropertiesAnyType: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesAnyType: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(JSONValue.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesAnyType, rhs: AdditionalPropertiesAnyType) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift index cf3d2db319f7..b23bc0f9b80b 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesArray: Content, Hashable { +public struct AdditionalPropertiesArray: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesArray: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap([JSONValue].self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesArray, rhs: AdditionalPropertiesArray) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift index e2908594503a..36e5b308d911 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesBoolean: Content, Hashable { +public struct AdditionalPropertiesBoolean: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesBoolean: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesBoolean, rhs: AdditionalPropertiesBoolean) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index dcbede7bc8fb..152cf59fd397 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesClass: Content, Hashable { +public struct AdditionalPropertiesClass: Sendable, Content, Hashable { public var mapString: [String: String]? public var mapNumber: [String: Double]? @@ -66,35 +66,5 @@ public final class AdditionalPropertiesClass: Content, Hashable { try container.encodeIfPresent(anytype2, forKey: .anytype2) try container.encodeIfPresent(anytype3, forKey: .anytype3) } - - public static func == (lhs: AdditionalPropertiesClass, rhs: AdditionalPropertiesClass) -> Bool { - lhs.mapString == rhs.mapString && - lhs.mapNumber == rhs.mapNumber && - lhs.mapInteger == rhs.mapInteger && - lhs.mapBoolean == rhs.mapBoolean && - lhs.mapArrayInteger == rhs.mapArrayInteger && - lhs.mapArrayAnytype == rhs.mapArrayAnytype && - lhs.mapMapString == rhs.mapMapString && - lhs.mapMapAnytype == rhs.mapMapAnytype && - lhs.anytype1 == rhs.anytype1 && - lhs.anytype2 == rhs.anytype2 && - lhs.anytype3 == rhs.anytype3 - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(mapString?.hashValue) - hasher.combine(mapNumber?.hashValue) - hasher.combine(mapInteger?.hashValue) - hasher.combine(mapBoolean?.hashValue) - hasher.combine(mapArrayInteger?.hashValue) - hasher.combine(mapArrayAnytype?.hashValue) - hasher.combine(mapMapString?.hashValue) - hasher.combine(mapMapAnytype?.hashValue) - hasher.combine(anytype1?.hashValue) - hasher.combine(anytype2?.hashValue) - hasher.combine(anytype3?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift index f90c9ffa7a62..b0a0313d676e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesInteger: Content, Hashable { +public struct AdditionalPropertiesInteger: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesInteger: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesInteger, rhs: AdditionalPropertiesInteger) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift index 5c6ae2f4740e..d96c6160f5eb 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesNumber: Content, Hashable { +public struct AdditionalPropertiesNumber: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesNumber: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesNumber, rhs: AdditionalPropertiesNumber) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift index 16dbb6aa01d5..ef397d62ab0f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesObject: Content, Hashable { +public struct AdditionalPropertiesObject: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesObject: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap([String: JSONValue].self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesObject, rhs: AdditionalPropertiesObject) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift index 27b7f315f1f4..ce1d463e89b4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesString: Content, Hashable { +public struct AdditionalPropertiesString: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesString: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesString, rhs: AdditionalPropertiesString) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift index e61742f7690f..408c19651482 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Animal: Content, Hashable { +public struct Animal: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -30,17 +30,5 @@ public final class Animal: Content, Hashable { try container.encode(className, forKey: .className) try container.encodeIfPresent(color, forKey: .color) } - - public static func == (lhs: Animal, rhs: Animal) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift index f9c5939be9b0..de7650f8c07a 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ApiResponse: Content, Hashable { +public struct ApiResponse: Sendable, Content, Hashable { public var code: Int? public var type: String? @@ -34,19 +34,5 @@ public final class ApiResponse: Content, Hashable { try container.encodeIfPresent(type, forKey: .type) try container.encodeIfPresent(message, forKey: .message) } - - public static func == (lhs: ApiResponse, rhs: ApiResponse) -> Bool { - lhs.code == rhs.code && - lhs.type == rhs.type && - lhs.message == rhs.message - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(code?.hashValue) - hasher.combine(type?.hashValue) - hasher.combine(message?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 60ae66f64e35..2a833c75ae67 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayOfArrayOfNumberOnly: Content, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Content, Hashable { public var arrayArrayNumber: [[Double]]? @@ -26,15 +26,5 @@ public final class ArrayOfArrayOfNumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber) } - - public static func == (lhs: ArrayOfArrayOfNumberOnly, rhs: ArrayOfArrayOfNumberOnly) -> Bool { - lhs.arrayArrayNumber == rhs.arrayArrayNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayArrayNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index f93ca8bdeaf2..d626bac392d9 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayOfNumberOnly: Content, Hashable { +public struct ArrayOfNumberOnly: Sendable, Content, Hashable { public var arrayNumber: [Double]? @@ -26,15 +26,5 @@ public final class ArrayOfNumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber) } - - public static func == (lhs: ArrayOfNumberOnly, rhs: ArrayOfNumberOnly) -> Bool { - lhs.arrayNumber == rhs.arrayNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift index e0a779991ca7..ddd10ecc24fb 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayTest: Content, Hashable { +public struct ArrayTest: Sendable, Content, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -34,19 +34,5 @@ public final class ArrayTest: Content, Hashable { try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger) try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel) } - - public static func == (lhs: ArrayTest, rhs: ArrayTest) -> Bool { - lhs.arrayOfString == rhs.arrayOfString && - lhs.arrayArrayOfInteger == rhs.arrayArrayOfInteger && - lhs.arrayArrayOfModel == rhs.arrayArrayOfModel - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayOfString?.hashValue) - hasher.combine(arrayArrayOfInteger?.hashValue) - hasher.combine(arrayArrayOfModel?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift index 38b07f79246b..fb372fb4f98e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class BigCat: Content, Hashable { +public struct BigCat: Sendable, Content, Hashable { public enum Kind: String, Sendable, Content, Hashable, CaseIterable { case lions = "lions" @@ -32,15 +32,5 @@ public final class BigCat: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(kind, forKey: .kind) } - - public static func == (lhs: BigCat, rhs: BigCat) -> Bool { - lhs.kind == rhs.kind - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(kind?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift index f0cc18c0f8c5..bd132c1edbce 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Capitalization: Content, Hashable { +public struct Capitalization: Sendable, Content, Hashable { public var smallCamel: String? public var capitalCamel: String? @@ -47,25 +47,5 @@ public final class Capitalization: Content, Hashable { try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints) try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME) } - - public static func == (lhs: Capitalization, rhs: Capitalization) -> Bool { - lhs.smallCamel == rhs.smallCamel && - lhs.capitalCamel == rhs.capitalCamel && - lhs.smallSnake == rhs.smallSnake && - lhs.capitalSnake == rhs.capitalSnake && - lhs.sCAETHFlowPoints == rhs.sCAETHFlowPoints && - lhs.ATT_NAME == rhs.ATT_NAME - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(smallCamel?.hashValue) - hasher.combine(capitalCamel?.hashValue) - hasher.combine(smallSnake?.hashValue) - hasher.combine(capitalSnake?.hashValue) - hasher.combine(sCAETHFlowPoints?.hashValue) - hasher.combine(ATT_NAME?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift index 37e70c0036ff..71adb11f6ef0 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Cat: Content, Hashable { +public struct Cat: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -34,19 +34,5 @@ public final class Cat: Content, Hashable { try container.encodeIfPresent(color, forKey: .color) try container.encodeIfPresent(declawed, forKey: .declawed) } - - public static func == (lhs: Cat, rhs: Cat) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color && - lhs.declawed == rhs.declawed - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - hasher.combine(declawed?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift index e2115d08fbe0..11497e0f7c5d 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Category: Content, Hashable { +public struct Category: Sendable, Content, Hashable { public var id: Int64? public var name: String = "default-name" @@ -30,20 +30,7 @@ public final class Category: Content, Hashable { try container.encodeIfPresent(id, forKey: .id) try container.encode(name, forKey: .name) } - - public static func == (lhs: Category, rhs: Category) -> Bool { - lhs.id == rhs.id && - lhs.name == rhs.name - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(name.hashValue) - - } } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Category: Identifiable {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift index 000d3658d224..b10c055f0300 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model with \"_class\" property */ -public final class ClassModel: Content, Hashable { +public struct ClassModel: Sendable, Content, Hashable { public var `class`: String? @@ -27,15 +27,5 @@ public final class ClassModel: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(`class`, forKey: .`class`) } - - public static func == (lhs: ClassModel, rhs: ClassModel) -> Bool { - lhs.`class` == rhs.`class` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(`class`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift index 4ba5219ddf21..bb40cd87b8a5 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Client: Content, Hashable { +public struct Client: Sendable, Content, Hashable { public var client: String? @@ -26,15 +26,5 @@ public final class Client: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(client, forKey: .client) } - - public static func == (lhs: Client, rhs: Client) -> Bool { - lhs.client == rhs.client - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(client?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift index a20eb84fffb7..25bd0592e206 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Dog: Content, Hashable { +public struct Dog: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -34,19 +34,5 @@ public final class Dog: Content, Hashable { try container.encodeIfPresent(color, forKey: .color) try container.encodeIfPresent(breed, forKey: .breed) } - - public static func == (lhs: Dog, rhs: Dog) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color && - lhs.breed == rhs.breed - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - hasher.combine(breed?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift index a563c354db7d..62d725acbbbd 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class EnumArrays: Content, Hashable { +public struct EnumArrays: Sendable, Content, Hashable { public enum JustSymbol: String, Sendable, Content, Hashable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -38,17 +38,5 @@ public final class EnumArrays: Content, Hashable { try container.encodeIfPresent(justSymbol, forKey: .justSymbol) try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum) } - - public static func == (lhs: EnumArrays, rhs: EnumArrays) -> Bool { - lhs.justSymbol == rhs.justSymbol && - lhs.arrayEnum == rhs.arrayEnum - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(justSymbol?.hashValue) - hasher.combine(arrayEnum?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift index 15779b57b9f9..3cf7147fe285 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class EnumTest: Content, Hashable { +public struct EnumTest: Sendable, Content, Hashable { public enum EnumString: String, Sendable, Content, Hashable, CaseIterable { case upper = "UPPER" @@ -60,23 +60,5 @@ public final class EnumTest: Content, Hashable { try container.encodeIfPresent(enumNumber, forKey: .enumNumber) try container.encodeIfPresent(outerEnum, forKey: .outerEnum) } - - public static func == (lhs: EnumTest, rhs: EnumTest) -> Bool { - lhs.enumString == rhs.enumString && - lhs.enumStringRequired == rhs.enumStringRequired && - lhs.enumInteger == rhs.enumInteger && - lhs.enumNumber == rhs.enumNumber && - lhs.outerEnum == rhs.outerEnum - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(enumString?.hashValue) - hasher.combine(enumStringRequired.hashValue) - hasher.combine(enumInteger?.hashValue) - hasher.combine(enumNumber?.hashValue) - hasher.combine(outerEnum?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift index 3b70313f505a..53b218ea6aae 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Must be named `File` for test. */ -public final class File: Content, Hashable { +public struct File: Sendable, Content, Hashable { /** Test capitalization */ public var sourceURI: String? @@ -28,15 +28,5 @@ public final class File: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(sourceURI, forKey: .sourceURI) } - - public static func == (lhs: File, rhs: File) -> Bool { - lhs.sourceURI == rhs.sourceURI - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(sourceURI?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index bc57101c274b..326b9f0d0d15 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class FileSchemaTestClass: Content, Hashable { +public struct FileSchemaTestClass: Sendable, Content, Hashable { public var file: File? public var files: [File]? @@ -30,17 +30,5 @@ public final class FileSchemaTestClass: Content, Hashable { try container.encodeIfPresent(file, forKey: .file) try container.encodeIfPresent(files, forKey: .files) } - - public static func == (lhs: FileSchemaTestClass, rhs: FileSchemaTestClass) -> Bool { - lhs.file == rhs.file && - lhs.files == rhs.files - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(file?.hashValue) - hasher.combine(files?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 570ef7166630..c91f6b451207 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class FormatTest: Content, Hashable { +public struct FormatTest: Sendable, Content, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) @@ -85,41 +85,5 @@ public final class FormatTest: Content, Hashable { try container.encode(password, forKey: .password) try container.encodeIfPresent(bigDecimal, forKey: .bigDecimal) } - - public static func == (lhs: FormatTest, rhs: FormatTest) -> Bool { - lhs.integer == rhs.integer && - lhs.int32 == rhs.int32 && - lhs.int64 == rhs.int64 && - lhs.number == rhs.number && - lhs.float == rhs.float && - lhs.double == rhs.double && - lhs.string == rhs.string && - lhs.byte == rhs.byte && - lhs.binary == rhs.binary && - lhs.date == rhs.date && - lhs.dateTime == rhs.dateTime && - lhs.uuid == rhs.uuid && - lhs.password == rhs.password && - lhs.bigDecimal == rhs.bigDecimal - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(integer?.hashValue) - hasher.combine(int32?.hashValue) - hasher.combine(int64?.hashValue) - hasher.combine(number.hashValue) - hasher.combine(float?.hashValue) - hasher.combine(double?.hashValue) - hasher.combine(string?.hashValue) - hasher.combine(byte.hashValue) - hasher.combine(binary?.hashValue) - hasher.combine(date.hashValue) - hasher.combine(dateTime?.hashValue) - hasher.combine(uuid?.hashValue) - hasher.combine(password.hashValue) - hasher.combine(bigDecimal?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index dfdb09175e4b..068ce1d7f1fe 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class HasOnlyReadOnly: Content, Hashable { +public struct HasOnlyReadOnly: Sendable, Content, Hashable { public var bar: String? public var foo: String? @@ -30,17 +30,5 @@ public final class HasOnlyReadOnly: Content, Hashable { try container.encodeIfPresent(bar, forKey: .bar) try container.encodeIfPresent(foo, forKey: .foo) } - - public static func == (lhs: HasOnlyReadOnly, rhs: HasOnlyReadOnly) -> Bool { - lhs.bar == rhs.bar && - lhs.foo == rhs.foo - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(bar?.hashValue) - hasher.combine(foo?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift index a96ff0eef787..0bf0e02a912f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class List: Content, Hashable { +public struct List: Sendable, Content, Hashable { public var _123list: String? @@ -26,15 +26,5 @@ public final class List: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(_123list, forKey: ._123list) } - - public static func == (lhs: List, rhs: List) -> Bool { - lhs._123list == rhs._123list - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(_123list?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift index d74262b414d8..e2cfc8125daa 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class MapTest: Content, Hashable { +public struct MapTest: Sendable, Content, Hashable { public enum MapOfEnumString: String, Sendable, Content, Hashable, CaseIterable { case upper = "UPPER" @@ -42,21 +42,5 @@ public final class MapTest: Content, Hashable { try container.encodeIfPresent(directMap, forKey: .directMap) try container.encodeIfPresent(indirectMap, forKey: .indirectMap) } - - public static func == (lhs: MapTest, rhs: MapTest) -> Bool { - lhs.mapMapOfString == rhs.mapMapOfString && - lhs.mapOfEnumString == rhs.mapOfEnumString && - lhs.directMap == rhs.directMap && - lhs.indirectMap == rhs.indirectMap - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(mapMapOfString?.hashValue) - hasher.combine(mapOfEnumString?.hashValue) - hasher.combine(directMap?.hashValue) - hasher.combine(indirectMap?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 61d7e38e0405..4cb274b14d33 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class MixedPropertiesAndAdditionalPropertiesClass: Content, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Content, Hashable { public var uuid: UUID? public var dateTime: Date? @@ -34,19 +34,5 @@ public final class MixedPropertiesAndAdditionalPropertiesClass: Content, Hashabl try container.encodeIfPresent(dateTime, forKey: .dateTime) try container.encodeIfPresent(map, forKey: .map) } - - public static func == (lhs: MixedPropertiesAndAdditionalPropertiesClass, rhs: MixedPropertiesAndAdditionalPropertiesClass) -> Bool { - lhs.uuid == rhs.uuid && - lhs.dateTime == rhs.dateTime && - lhs.map == rhs.map - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(uuid?.hashValue) - hasher.combine(dateTime?.hashValue) - hasher.combine(map?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift index 40e36b4ca39c..6a6c76eb5e9e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model name starting with number */ -public final class Model200Response: Content, Hashable { +public struct Model200Response: Sendable, Content, Hashable { public var name: Int? public var `class`: String? @@ -31,17 +31,5 @@ public final class Model200Response: Content, Hashable { try container.encodeIfPresent(name, forKey: .name) try container.encodeIfPresent(`class`, forKey: .`class`) } - - public static func == (lhs: Model200Response, rhs: Model200Response) -> Bool { - lhs.name == rhs.name && - lhs.`class` == rhs.`class` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(`class`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift index ef9692a6603f..62db357d768c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model name same as property name */ -public final class Name: Content, Hashable { +public struct Name: Sendable, Content, Hashable { public var name: Int public var snakeCase: Int? @@ -39,21 +39,5 @@ public final class Name: Content, Hashable { try container.encodeIfPresent(property, forKey: .property) try container.encodeIfPresent(_123number, forKey: ._123number) } - - public static func == (lhs: Name, rhs: Name) -> Bool { - lhs.name == rhs.name && - lhs.snakeCase == rhs.snakeCase && - lhs.property == rhs.property && - lhs._123number == rhs._123number - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name.hashValue) - hasher.combine(snakeCase?.hashValue) - hasher.combine(property?.hashValue) - hasher.combine(_123number?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift index 9c451e9f0182..2b3671db5bd4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class NumberOnly: Content, Hashable { +public struct NumberOnly: Sendable, Content, Hashable { public var justNumber: Double? @@ -26,15 +26,5 @@ public final class NumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(justNumber, forKey: .justNumber) } - - public static func == (lhs: NumberOnly, rhs: NumberOnly) -> Bool { - lhs.justNumber == rhs.justNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(justNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift index c6ebc2461026..366bcfad21ab 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Order: Content, Hashable { +public struct Order: Sendable, Content, Hashable { public enum Status: String, Sendable, Content, Hashable, CaseIterable { case placed = "placed" @@ -52,28 +52,7 @@ public final class Order: Content, Hashable { try container.encodeIfPresent(status, forKey: .status) try container.encodeIfPresent(complete, forKey: .complete) } - - public static func == (lhs: Order, rhs: Order) -> Bool { - lhs.id == rhs.id && - lhs.petId == rhs.petId && - lhs.quantity == rhs.quantity && - lhs.shipDate == rhs.shipDate && - lhs.status == rhs.status && - lhs.complete == rhs.complete - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(petId?.hashValue) - hasher.combine(quantity?.hashValue) - hasher.combine(shipDate?.hashValue) - hasher.combine(status?.hashValue) - hasher.combine(complete?.hashValue) - - } } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Order: Identifiable {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift index d7696fe5c9f9..a6e486079b40 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class OuterComposite: Content, Hashable { +public struct OuterComposite: Sendable, Content, Hashable { public var myNumber: Double? public var myString: String? @@ -34,19 +34,5 @@ public final class OuterComposite: Content, Hashable { try container.encodeIfPresent(myString, forKey: .myString) try container.encodeIfPresent(myBoolean, forKey: .myBoolean) } - - public static func == (lhs: OuterComposite, rhs: OuterComposite) -> Bool { - lhs.myNumber == rhs.myNumber && - lhs.myString == rhs.myString && - lhs.myBoolean == rhs.myBoolean - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(myNumber?.hashValue) - hasher.combine(myString?.hashValue) - hasher.combine(myBoolean?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift index 04cffcaa7fc0..5a84b2a05897 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Pet: Content, Hashable { +public struct Pet: Sendable, Content, Hashable { public enum Status: String, Sendable, Content, Hashable, CaseIterable { case available = "available" @@ -53,28 +53,7 @@ public final class Pet: Content, Hashable { try container.encodeIfPresent(tags, forKey: .tags) try container.encodeIfPresent(status, forKey: .status) } - - public static func == (lhs: Pet, rhs: Pet) -> Bool { - lhs.id == rhs.id && - lhs.category == rhs.category && - lhs.name == rhs.name && - lhs.photoUrls == rhs.photoUrls && - lhs.tags == rhs.tags && - lhs.status == rhs.status - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(category?.hashValue) - hasher.combine(name.hashValue) - hasher.combine(photoUrls.hashValue) - hasher.combine(tags?.hashValue) - hasher.combine(status?.hashValue) - - } } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Pet: Identifiable {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index c48fc99cdc81..76d6474b03c5 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ReadOnlyFirst: Content, Hashable { +public struct ReadOnlyFirst: Sendable, Content, Hashable { public var bar: String? public var baz: String? @@ -30,17 +30,5 @@ public final class ReadOnlyFirst: Content, Hashable { try container.encodeIfPresent(bar, forKey: .bar) try container.encodeIfPresent(baz, forKey: .baz) } - - public static func == (lhs: ReadOnlyFirst, rhs: ReadOnlyFirst) -> Bool { - lhs.bar == rhs.bar && - lhs.baz == rhs.baz - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(bar?.hashValue) - hasher.combine(baz?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift index 45415afbd2bf..564dac3a7786 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing reserved words */ -public final class Return: Content, Hashable { +public struct Return: Sendable, Content, Hashable { public var `return`: Int? @@ -27,15 +27,5 @@ public final class Return: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(`return`, forKey: .`return`) } - - public static func == (lhs: Return, rhs: Return) -> Bool { - lhs.`return` == rhs.`return` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(`return`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift index 9319338bde68..3d6a0df0a3a3 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class SpecialModelName: Content, Hashable { +public struct SpecialModelName: Sendable, Content, Hashable { public var specialPropertyName: Int64? @@ -26,15 +26,5 @@ public final class SpecialModelName: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName) } - - public static func == (lhs: SpecialModelName, rhs: SpecialModelName) -> Bool { - lhs.specialPropertyName == rhs.specialPropertyName - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(specialPropertyName?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift index e558e254f531..2e29564a9433 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class StringBooleanMap: Content, Hashable { +public struct StringBooleanMap: Sendable, Content, Hashable { public enum CodingKeys: CodingKey, CaseIterable { @@ -46,13 +46,5 @@ public final class StringBooleanMap: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: StringBooleanMap, rhs: StringBooleanMap) -> Bool { - lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift index 530aec30b0b0..d7665cf1771e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Tag: Content, Hashable { +public struct Tag: Sendable, Content, Hashable { public var id: Int64? public var name: String? @@ -30,20 +30,7 @@ public final class Tag: Content, Hashable { try container.encodeIfPresent(id, forKey: .id) try container.encodeIfPresent(name, forKey: .name) } - - public static func == (lhs: Tag, rhs: Tag) -> Bool { - lhs.id == rhs.id && - lhs.name == rhs.name - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(name?.hashValue) - - } } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension Tag: Identifiable {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift index 766b73224e99..dbea8378ba21 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class TypeHolderDefault: Content, Hashable { +public struct TypeHolderDefault: Sendable, Content, Hashable { public var stringItem: String = "what" public var numberItem: Double @@ -42,23 +42,5 @@ public final class TypeHolderDefault: Content, Hashable { try container.encode(boolItem, forKey: .boolItem) try container.encode(arrayItem, forKey: .arrayItem) } - - public static func == (lhs: TypeHolderDefault, rhs: TypeHolderDefault) -> Bool { - lhs.stringItem == rhs.stringItem && - lhs.numberItem == rhs.numberItem && - lhs.integerItem == rhs.integerItem && - lhs.boolItem == rhs.boolItem && - lhs.arrayItem == rhs.arrayItem - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(stringItem.hashValue) - hasher.combine(numberItem.hashValue) - hasher.combine(integerItem.hashValue) - hasher.combine(boolItem.hashValue) - hasher.combine(arrayItem.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift index 8115aacedbac..78e61dd7714f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class TypeHolderExample: Content, Hashable { +public struct TypeHolderExample: Sendable, Content, Hashable { public var stringItem: String public var numberItem: Double @@ -46,25 +46,5 @@ public final class TypeHolderExample: Content, Hashable { try container.encode(boolItem, forKey: .boolItem) try container.encode(arrayItem, forKey: .arrayItem) } - - public static func == (lhs: TypeHolderExample, rhs: TypeHolderExample) -> Bool { - lhs.stringItem == rhs.stringItem && - lhs.numberItem == rhs.numberItem && - lhs.floatItem == rhs.floatItem && - lhs.integerItem == rhs.integerItem && - lhs.boolItem == rhs.boolItem && - lhs.arrayItem == rhs.arrayItem - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(stringItem.hashValue) - hasher.combine(numberItem.hashValue) - hasher.combine(floatItem.hashValue) - hasher.combine(integerItem.hashValue) - hasher.combine(boolItem.hashValue) - hasher.combine(arrayItem.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift index 38fbd26b4303..3cb01c898704 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class User: Content, Hashable { +public struct User: Sendable, Content, Hashable { public var id: Int64? public var username: String? @@ -55,32 +55,7 @@ public final class User: Content, Hashable { try container.encodeIfPresent(phone, forKey: .phone) try container.encodeIfPresent(userStatus, forKey: .userStatus) } - - public static func == (lhs: User, rhs: User) -> Bool { - lhs.id == rhs.id && - lhs.username == rhs.username && - lhs.firstName == rhs.firstName && - lhs.lastName == rhs.lastName && - lhs.email == rhs.email && - lhs.password == rhs.password && - lhs.phone == rhs.phone && - lhs.userStatus == rhs.userStatus - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(username?.hashValue) - hasher.combine(firstName?.hashValue) - hasher.combine(lastName?.hashValue) - hasher.combine(email?.hashValue) - hasher.combine(password?.hashValue) - hasher.combine(phone?.hashValue) - hasher.combine(userStatus?.hashValue) - - } } -@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *) extension User: Identifiable {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift index 6a66d8e7e829..91fc7cd5a225 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class XmlItem: Content, Hashable { +public struct XmlItem: Sendable, Content, Hashable { public var attributeString: String? public var attributeNumber: Double? @@ -138,71 +138,5 @@ public final class XmlItem: Content, Hashable { try container.encodeIfPresent(prefixNsArray, forKey: .prefixNsArray) try container.encodeIfPresent(prefixNsWrappedArray, forKey: .prefixNsWrappedArray) } - - public static func == (lhs: XmlItem, rhs: XmlItem) -> Bool { - lhs.attributeString == rhs.attributeString && - lhs.attributeNumber == rhs.attributeNumber && - lhs.attributeInteger == rhs.attributeInteger && - lhs.attributeBoolean == rhs.attributeBoolean && - lhs.wrappedArray == rhs.wrappedArray && - lhs.nameString == rhs.nameString && - lhs.nameNumber == rhs.nameNumber && - lhs.nameInteger == rhs.nameInteger && - lhs.nameBoolean == rhs.nameBoolean && - lhs.nameArray == rhs.nameArray && - lhs.nameWrappedArray == rhs.nameWrappedArray && - lhs.prefixString == rhs.prefixString && - lhs.prefixNumber == rhs.prefixNumber && - lhs.prefixInteger == rhs.prefixInteger && - lhs.prefixBoolean == rhs.prefixBoolean && - lhs.prefixArray == rhs.prefixArray && - lhs.prefixWrappedArray == rhs.prefixWrappedArray && - lhs.namespaceString == rhs.namespaceString && - lhs.namespaceNumber == rhs.namespaceNumber && - lhs.namespaceInteger == rhs.namespaceInteger && - lhs.namespaceBoolean == rhs.namespaceBoolean && - lhs.namespaceArray == rhs.namespaceArray && - lhs.namespaceWrappedArray == rhs.namespaceWrappedArray && - lhs.prefixNsString == rhs.prefixNsString && - lhs.prefixNsNumber == rhs.prefixNsNumber && - lhs.prefixNsInteger == rhs.prefixNsInteger && - lhs.prefixNsBoolean == rhs.prefixNsBoolean && - lhs.prefixNsArray == rhs.prefixNsArray && - lhs.prefixNsWrappedArray == rhs.prefixNsWrappedArray - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(attributeString?.hashValue) - hasher.combine(attributeNumber?.hashValue) - hasher.combine(attributeInteger?.hashValue) - hasher.combine(attributeBoolean?.hashValue) - hasher.combine(wrappedArray?.hashValue) - hasher.combine(nameString?.hashValue) - hasher.combine(nameNumber?.hashValue) - hasher.combine(nameInteger?.hashValue) - hasher.combine(nameBoolean?.hashValue) - hasher.combine(nameArray?.hashValue) - hasher.combine(nameWrappedArray?.hashValue) - hasher.combine(prefixString?.hashValue) - hasher.combine(prefixNumber?.hashValue) - hasher.combine(prefixInteger?.hashValue) - hasher.combine(prefixBoolean?.hashValue) - hasher.combine(prefixArray?.hashValue) - hasher.combine(prefixWrappedArray?.hashValue) - hasher.combine(namespaceString?.hashValue) - hasher.combine(namespaceNumber?.hashValue) - hasher.combine(namespaceInteger?.hashValue) - hasher.combine(namespaceBoolean?.hashValue) - hasher.combine(namespaceArray?.hashValue) - hasher.combine(namespaceWrappedArray?.hashValue) - hasher.combine(prefixNsString?.hashValue) - hasher.combine(prefixNsNumber?.hashValue) - hasher.combine(prefixNsInteger?.hashValue) - hasher.combine(prefixNsBoolean?.hashValue) - hasher.combine(prefixNsArray?.hashValue) - hasher.combine(prefixNsWrappedArray?.hashValue) - - } } diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v20-provided-in-root/package-lock.json b/samples/client/petstore/typescript-angular-v20-provided-in-root/package-lock.json index 0330f7256676..35b582cabf5d 100644 --- a/samples/client/petstore/typescript-angular-v20-provided-in-root/package-lock.json +++ b/samples/client/petstore/typescript-angular-v20-provided-in-root/package-lock.json @@ -12412,9 +12412,9 @@ } }, "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", "dev": true, "license": "MIT" }, diff --git a/samples/client/petstore/typescript-angular-v20/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v20/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v20/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v20/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-angular-v21/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v21/builds/default/configuration.ts index 775b99892d50..830d98b65222 100644 --- a/samples/client/petstore/typescript-angular-v21/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v21/builds/default/configuration.ts @@ -1,5 +1,6 @@ -import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; export interface ConfigurationParameters { /** @@ -179,7 +180,7 @@ constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, : headers; } - public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { const value = this.lookupCredential(credentialKey); return value ? query.set(paramName, value) diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts index ae2d4c75887f..161e7843da3f 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts @@ -32,8 +32,9 @@ export interface ListRequest { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for list without sending the request */ - async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async listRequestOpts(requestParameters: ListRequest): Promise { if (requestParameters['personId'] == null) { throw new runtime.RequiredError( 'personId', @@ -49,12 +50,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/person/display/{personId}`; urlPath = urlPath.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.listRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClubFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts index ae2d4c75887f..161e7843da3f 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts @@ -32,8 +32,9 @@ export interface ListRequest { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for list without sending the request */ - async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async listRequestOpts(requestParameters: ListRequest): Promise { if (requestParameters['personId'] == null) { throw new runtime.RequiredError( 'personId', @@ -49,12 +50,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/person/display/{personId}`; urlPath = urlPath.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.listRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClubFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts index f5ba5857f5c5..9a60e65c5dcb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts @@ -32,10 +32,9 @@ export interface 123testSpecialTagsRequest { export class AnotherFakeApi extends runtime.BaseAPI { /** - * To test special tags and operation ID starting with number - * To test special tags + * Creates request options for _123testSpecialTags without sending the request */ - async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async _123testSpecialTagsRequestOpts(requestParameters: 123testSpecialTagsRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -52,13 +51,22 @@ export class AnotherFakeApi extends runtime.BaseAPI { let urlPath = `/another-fake/dummy`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + */ + async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this._123testSpecialTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts index ce1e24dc07f2..7d65d746446a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts @@ -28,8 +28,9 @@ import { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for fooGet without sending the request */ - async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fooGetRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -37,12 +38,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/foo`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fooGetRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FooGetDefaultResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 0eef4125671b..1040e20d8989 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -174,9 +174,9 @@ export interface TestStringMapReferenceRequest { export class FakeApi extends runtime.BaseAPI { /** - * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * Creates request options for fakeBigDecimalMap without sending the request */ - async fakeBigDecimalMapRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeBigDecimalMapRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -184,12 +184,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/BigDecimalMap`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + async fakeBigDecimalMapRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeBigDecimalMapRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeBigDecimalMap200ResponseFromJSON(jsonValue)); } @@ -203,9 +211,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Health check endpoint + * Creates request options for fakeHealthGet without sending the request */ - async fakeHealthGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeHealthGetRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -213,12 +221,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/health`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Health check endpoint + */ + async fakeHealthGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeHealthGetRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => HealthCheckResultFromJSON(jsonValue)); } @@ -232,9 +248,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * test http signature authentication + * Creates request options for fakeHttpSignatureTest without sending the request */ - async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeHttpSignatureTestRequestOpts(requestParameters: FakeHttpSignatureTestRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -259,13 +275,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/http-signature-test`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * test http signature authentication + */ + async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeHttpSignatureTestRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -278,9 +302,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer boolean types + * Creates request options for fakeOuterBooleanSerialize without sending the request */ - async fakeOuterBooleanSerializeRaw(requestParameters: FakeOuterBooleanSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterBooleanSerializeRequestOpts(requestParameters: FakeOuterBooleanSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -290,13 +314,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/boolean`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer boolean types + */ + async fakeOuterBooleanSerializeRaw(requestParameters: FakeOuterBooleanSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterBooleanSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -314,9 +346,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of object with outer number type + * Creates request options for fakeOuterCompositeSerialize without sending the request */ - async fakeOuterCompositeSerializeRaw(requestParameters: FakeOuterCompositeSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterCompositeSerializeRequestOpts(requestParameters: FakeOuterCompositeSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -326,13 +358,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/composite`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OuterCompositeToJSON(requestParameters['outerComposite']), - }, initOverrides); + }; + } + + /** + * Test serialization of object with outer number type + */ + async fakeOuterCompositeSerializeRaw(requestParameters: FakeOuterCompositeSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterCompositeSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterCompositeFromJSON(jsonValue)); } @@ -346,9 +386,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer number types + * Creates request options for fakeOuterNumberSerialize without sending the request */ - async fakeOuterNumberSerializeRaw(requestParameters: FakeOuterNumberSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterNumberSerializeRequestOpts(requestParameters: FakeOuterNumberSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -358,13 +398,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/number`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer number types + */ + async fakeOuterNumberSerializeRaw(requestParameters: FakeOuterNumberSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterNumberSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -382,9 +430,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer string types + * Creates request options for fakeOuterStringSerialize without sending the request */ - async fakeOuterStringSerializeRaw(requestParameters: FakeOuterStringSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterStringSerializeRequestOpts(requestParameters: FakeOuterStringSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -394,13 +442,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/string`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer string types + */ + async fakeOuterStringSerializeRaw(requestParameters: FakeOuterStringSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterStringSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -418,9 +474,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of enum (int) properties with examples + * Creates request options for fakePropertyEnumIntegerSerialize without sending the request */ - async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakePropertyEnumIntegerSerializeRequestOpts(requestParameters: FakePropertyEnumIntegerSerializeRequest): Promise { if (requestParameters['outerObjectWithEnumProperty'] == null) { throw new runtime.RequiredError( 'outerObjectWithEnumProperty', @@ -437,13 +493,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/property/enum-int`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OuterObjectWithEnumPropertyToJSON(requestParameters['outerObjectWithEnumProperty']), - }, initOverrides); + }; + } + + /** + * Test serialization of enum (int) properties with examples + */ + async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakePropertyEnumIntegerSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterObjectWithEnumPropertyFromJSON(jsonValue)); } @@ -457,10 +521,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test referenced additionalProperties + * Creates request options for testAdditionalPropertiesReference without sending the request */ - async testAdditionalPropertiesReferenceRaw(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testAdditionalPropertiesReferenceRequestOpts(requestParameters: TestAdditionalPropertiesReferenceRequest): Promise { if (requestParameters['requestBody'] == null) { throw new runtime.RequiredError( 'requestBody', @@ -477,13 +540,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/additionalProperties-reference`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['requestBody'], - }, initOverrides); + }; + } + + /** + * + * test referenced additionalProperties + */ + async testAdditionalPropertiesReferenceRaw(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testAdditionalPropertiesReferenceRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -497,9 +569,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * For this test, the body has to be a binary file. + * Creates request options for testBodyWithBinary without sending the request */ - async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithBinaryRequestOpts(requestParameters: TestBodyWithBinaryRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -516,13 +588,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-binary`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * For this test, the body has to be a binary file. + */ + async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithBinaryRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -535,9 +615,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * For this test, the body for this request must reference a schema named `File`. + * Creates request options for testBodyWithFileSchema without sending the request */ - async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithFileSchemaRequestOpts(requestParameters: TestBodyWithFileSchemaRequest): Promise { if (requestParameters['fileSchemaTestClass'] == null) { throw new runtime.RequiredError( 'fileSchemaTestClass', @@ -554,13 +634,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-file-schema`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: FileSchemaTestClassToJSON(requestParameters['fileSchemaTestClass']), - }, initOverrides); + }; + } + + /** + * For this test, the body for this request must reference a schema named `File`. + */ + async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithFileSchemaRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -573,8 +661,9 @@ export class FakeApi extends runtime.BaseAPI { } /** + * Creates request options for testBodyWithQueryParams without sending the request */ - async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithQueryParamsRequestOpts(requestParameters: TestBodyWithQueryParamsRequest): Promise { if (requestParameters['query'] == null) { throw new runtime.RequiredError( 'query', @@ -602,13 +691,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-query-params`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + */ + async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithQueryParamsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -620,10 +716,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test \"client\" model - * To test \"client\" model + * Creates request options for testClientModel without sending the request */ - async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testClientModelRequestOpts(requestParameters: TestClientModelRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -640,13 +735,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test \"client\" model + * To test \"client\" model + */ + async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testClientModelRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } @@ -661,10 +765,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Creates request options for testEndpointParameters without sending the request */ - async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testEndpointParametersRequestOpts(requestParameters: TestEndpointParametersRequest): Promise { if (requestParameters['number'] == null) { throw new runtime.RequiredError( 'number', @@ -775,13 +878,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + */ + async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testEndpointParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -795,10 +907,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test enum parameters - * To test enum parameters + * Creates request options for testEnumParameters without sending the request */ - async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testEnumParametersRequestOpts(requestParameters: TestEnumParametersRequest): Promise { const queryParameters: any = {}; if (requestParameters['enumQueryStringArray'] != null) { @@ -856,13 +967,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * To test enum parameters + * To test enum parameters + */ + async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testEnumParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -876,10 +996,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Fake endpoint to test group parameters (optional) - * Fake endpoint to test group parameters (optional) + * Creates request options for testGroupParameters without sending the request */ - async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testGroupParametersRequestOpts(requestParameters: TestGroupParametersRequest): Promise { if (requestParameters['requiredStringGroup'] == null) { throw new runtime.RequiredError( 'requiredStringGroup', @@ -940,12 +1059,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + */ + async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testGroupParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -959,10 +1087,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test inline additionalProperties + * Creates request options for testInlineAdditionalProperties without sending the request */ - async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testInlineAdditionalPropertiesRequestOpts(requestParameters: TestInlineAdditionalPropertiesRequest): Promise { if (requestParameters['requestBody'] == null) { throw new runtime.RequiredError( 'requestBody', @@ -979,13 +1106,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/inline-additionalProperties`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['requestBody'], - }, initOverrides); + }; + } + + /** + * + * test inline additionalProperties + */ + async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testInlineAdditionalPropertiesRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -999,10 +1135,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test inline free-form additionalProperties + * Creates request options for testInlineFreeformAdditionalProperties without sending the request */ - async testInlineFreeformAdditionalPropertiesRaw(requestParameters: TestInlineFreeformAdditionalPropertiesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testInlineFreeformAdditionalPropertiesRequestOpts(requestParameters: TestInlineFreeformAdditionalPropertiesOperationRequest): Promise { if (requestParameters['testInlineFreeformAdditionalPropertiesRequest'] == null) { throw new runtime.RequiredError( 'testInlineFreeformAdditionalPropertiesRequest', @@ -1019,13 +1154,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/inline-freeform-additionalProperties`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: TestInlineFreeformAdditionalPropertiesRequestToJSON(requestParameters['testInlineFreeformAdditionalPropertiesRequest']), - }, initOverrides); + }; + } + + /** + * + * test inline free-form additionalProperties + */ + async testInlineFreeformAdditionalPropertiesRaw(requestParameters: TestInlineFreeformAdditionalPropertiesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testInlineFreeformAdditionalPropertiesRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -1039,10 +1183,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test json serialization of form data + * Creates request options for testJsonFormData without sending the request */ - async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testJsonFormDataRequestOpts(requestParameters: TestJsonFormDataRequest): Promise { if (requestParameters['param'] == null) { throw new runtime.RequiredError( 'param', @@ -1086,13 +1229,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/jsonFormData`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * test json serialization of form data + */ + async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testJsonFormDataRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -1106,10 +1258,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test nullable parent property + * Creates request options for testNullable without sending the request */ - async testNullableRaw(requestParameters: TestNullableRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testNullableRequestOpts(requestParameters: TestNullableRequest): Promise { if (requestParameters['childWithNullable'] == null) { throw new runtime.RequiredError( 'childWithNullable', @@ -1126,13 +1277,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/nullable`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ChildWithNullableToJSON(requestParameters['childWithNullable']), - }, initOverrides); + }; + } + + /** + * + * test nullable parent property + */ + async testNullableRaw(requestParameters: TestNullableRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testNullableRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -1146,9 +1306,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test the collection format in query parameters + * Creates request options for testQueryParameterCollectionFormat without sending the request */ - async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testQueryParameterCollectionFormatRequestOpts(requestParameters: TestQueryParameterCollectionFormatRequest): Promise { if (requestParameters['pipe'] == null) { throw new runtime.RequiredError( 'pipe', @@ -1228,12 +1388,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/test-query-parameters`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * To test the collection format in query parameters + */ + async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testQueryParameterCollectionFormatRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -1246,10 +1414,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test referenced string map + * Creates request options for testStringMapReference without sending the request */ - async testStringMapReferenceRaw(requestParameters: TestStringMapReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testStringMapReferenceRequestOpts(requestParameters: TestStringMapReferenceRequest): Promise { if (requestParameters['requestBody'] == null) { throw new runtime.RequiredError( 'requestBody', @@ -1266,13 +1433,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/stringMap-reference`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['requestBody'], - }, initOverrides); + }; + } + + /** + * + * test referenced string map + */ + async testStringMapReferenceRaw(requestParameters: TestStringMapReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testStringMapReferenceRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts index cdefdb8e7951..9dfcce8210eb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts @@ -32,10 +32,9 @@ export interface TestClassnameRequest { export class FakeClassnameTags123Api extends runtime.BaseAPI { /** - * To test class name in snake case - * To test class name in snake case + * Creates request options for testClassname without sending the request */ - async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testClassnameRequestOpts(requestParameters: TestClassnameRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -56,13 +55,22 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { let urlPath = `/fake_classname_test`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test class name in snake case + * To test class name in snake case + */ + async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testClassnameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index 2a9812520139..6023f2567eeb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -74,10 +74,9 @@ export interface UploadFileWithRequiredFileRequest { export class PetApi extends runtime.BaseAPI { /** - * - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -99,13 +98,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -119,10 +127,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -147,12 +154,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -166,10 +182,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -193,12 +208,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -213,11 +237,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -241,12 +264,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => new Set(jsonValue.map(PetFromJSON))); } @@ -262,10 +295,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -285,12 +317,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -305,10 +346,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -330,13 +370,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -350,10 +399,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -396,13 +444,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -416,10 +473,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -464,13 +520,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } @@ -485,10 +550,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * uploads an image (required) + * Creates request options for uploadFileWithRequiredFile without sending the request */ - async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileWithRequiredFileRequestOpts(requestParameters: UploadFileWithRequiredFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -540,13 +604,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/fake/{petId}/uploadImageWithRequiredFile`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * uploads an image (required) + */ + async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileWithRequiredFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts index 3ba8c2cab723..3d4b3f1b0c46 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{order_id}`; urlPath = urlPath.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{order_id}`; urlPath = urlPath.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,10 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['order'] == null) { throw new runtime.RequiredError( 'order', @@ -172,13 +195,22 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['order']), - }, initOverrides); + }; + } + + /** + * + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts index 83a5374e23a5..029e2bea4d2b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,10 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -118,13 +125,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -138,10 +154,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -158,13 +173,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -178,10 +202,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -197,12 +220,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -216,10 +248,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -235,12 +266,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -255,10 +295,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -288,12 +327,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -312,10 +360,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -323,12 +370,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -342,10 +398,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -370,13 +425,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 586438f033c4..360d2bff6ebc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -68,9 +68,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -92,13 +92,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -111,9 +119,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -138,12 +146,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -156,10 +172,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -183,12 +198,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -203,11 +227,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -231,12 +254,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -252,10 +285,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -275,12 +307,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -295,9 +336,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -319,13 +360,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -338,9 +387,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -383,13 +432,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -402,9 +459,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -449,13 +506,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts index 0bcfdbf84600..71133d29c3d1 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts index 43799227666d..9240a2473288 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,9 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -117,13 +125,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -136,9 +152,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -155,13 +171,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -174,10 +198,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -193,12 +216,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -212,9 +244,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -230,12 +262,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -249,9 +289,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -281,12 +321,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -304,9 +352,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -314,12 +362,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,10 +388,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -360,13 +415,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts index d6ef42525e47..19d943747fe3 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts @@ -59,8 +59,9 @@ export interface FakeEnumRequestPostRefRequest { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for fakeEnumRequestGetInline without sending the request */ - async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestGetInlineRequestOpts(requestParameters: FakeEnumRequestGetInlineRequest): Promise { const queryParameters: any = {}; if (requestParameters['stringEnum'] != null) { @@ -84,12 +85,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-inline`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestGetInlineRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } @@ -102,8 +110,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestGetRef without sending the request */ - async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestGetRefRequestOpts(requestParameters: FakeEnumRequestGetRefRequest): Promise { const queryParameters: any = {}; if (requestParameters['stringEnum'] != null) { @@ -127,12 +136,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-ref`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestGetRefRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); } @@ -145,8 +161,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestPostInline without sending the request */ - async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestPostInlineRequestOpts(requestParameters: FakeEnumRequestPostInlineRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -156,13 +173,20 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-inline`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters['fakeEnumRequestGetInline200Response']), - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestPostInlineRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } @@ -175,8 +199,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestPostRef without sending the request */ - async fakeEnumRequestPostRefRaw(requestParameters: FakeEnumRequestPostRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestPostRefRequestOpts(requestParameters: FakeEnumRequestPostRefRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -186,13 +211,20 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-ref`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: EnumPatternObjectToJSON(requestParameters['enumPatternObject']), - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestPostRefRaw(requestParameters: FakeEnumRequestPostRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestPostRefRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 586438f033c4..360d2bff6ebc 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -68,9 +68,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -92,13 +92,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -111,9 +119,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -138,12 +146,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -156,10 +172,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -183,12 +198,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -203,11 +227,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -231,12 +254,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -252,10 +285,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -275,12 +307,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -295,9 +336,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -319,13 +360,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -338,9 +387,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -383,13 +432,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -402,9 +459,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -449,13 +506,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts index 0bcfdbf84600..71133d29c3d1 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts index 43799227666d..9240a2473288 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,9 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -117,13 +125,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -136,9 +152,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -155,13 +171,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -174,10 +198,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -193,12 +216,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -212,9 +244,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -230,12 +262,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -249,9 +289,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -281,12 +321,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -304,9 +352,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -314,12 +362,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,10 +388,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -360,13 +415,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index 1c67884763ce..7121cdc16bfd 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -68,9 +68,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -92,13 +92,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -111,9 +119,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -138,12 +146,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -156,10 +172,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -183,12 +198,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -203,11 +227,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -231,12 +254,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -252,10 +285,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -275,12 +307,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -295,9 +336,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -319,13 +360,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -338,9 +387,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -383,13 +432,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -402,9 +459,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -449,13 +506,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts index b3a1f18a31ce..ae3154c8ffad 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index eb9fbebf507e..ffb33048e34a 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,9 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -117,13 +125,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -136,9 +152,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -155,13 +171,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -174,10 +198,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -193,12 +216,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -212,9 +244,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -230,12 +262,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -249,9 +289,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -281,12 +321,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -304,9 +352,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -314,12 +362,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,10 +388,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -360,13 +415,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/apis/DefaultApi.ts index 4d855b758fb7..725866801ae3 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/apis/DefaultApi.ts @@ -34,8 +34,9 @@ import { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for test without sending the request */ - async testRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -43,12 +44,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/test`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async testRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TestResponseFromJSON(jsonValue)); } @@ -61,8 +69,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for testArray without sending the request */ - async testArrayRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testArrayRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -70,12 +79,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/test-array`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async testArrayRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testArrayRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TestArrayResponseFromJSON(jsonValue)); } @@ -88,8 +104,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for testDiscriminator without sending the request */ - async testDiscriminatorRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testDiscriminatorRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -97,12 +114,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/test-discriminator`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async testDiscriminatorRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testDiscriminatorRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TestDiscriminatorResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 4503fa90ce10..5f3cc2bf87b9 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -68,9 +68,9 @@ export interface PetApiUploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: PetApiAddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: PetApiAddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -92,13 +92,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: PetApiAddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -111,9 +119,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: PetApiDeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: PetApiDeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -138,12 +146,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: PetApiDeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -156,10 +172,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: PetApiFindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -183,12 +198,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -203,11 +227,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: PetApiFindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -231,12 +254,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -252,10 +285,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: PetApiGetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -275,12 +307,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -295,9 +336,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: PetApiUpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: PetApiUpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -319,13 +360,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: PetApiUpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -338,9 +387,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: PetApiUpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -383,13 +432,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -402,9 +459,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: PetApiUploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: PetApiUploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -449,13 +506,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: PetApiUploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index c0a916bebe98..5a13cd0fa00c 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface StoreApiPlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: StoreApiDeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: StoreApiGetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: StoreApiPlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 6b8bd7d113b5..b7a2fd282f6a 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UserApiUpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: UserApiCreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: UserApiCreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: UserApiCreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,9 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: UserApiCreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -117,13 +125,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -136,9 +152,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: UserApiCreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -155,13 +171,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -174,10 +198,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: UserApiDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: UserApiDeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -193,12 +216,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: UserApiDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -212,9 +244,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: UserApiGetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -230,12 +262,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -249,9 +289,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: UserApiLoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: UserApiLoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -281,12 +321,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: UserApiLoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -304,9 +352,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -314,12 +362,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,10 +388,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UserApiUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UserApiUpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -360,13 +415,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UserApiUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts index eaee9f44b95e..05f0a2328e6c 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts @@ -39,9 +39,9 @@ export interface GetBehaviorTypeRequest { export class BehaviorApi extends runtime.BaseAPI { /** - * Get permissions for the behavior + * Creates request options for getBehaviorPermissions without sending the request */ - async getBehaviorPermissionsRaw(requestParameters: GetBehaviorPermissionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getBehaviorPermissionsRequestOpts(requestParameters: GetBehaviorPermissionsRequest): Promise { if (requestParameters['behaviorId'] == null) { throw new runtime.RequiredError( 'behaviorId', @@ -57,12 +57,20 @@ export class BehaviorApi extends runtime.BaseAPI { let urlPath = `/fake_behavior/{behavior-id}/permissions`; urlPath = urlPath.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters['behaviorId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get permissions for the behavior + */ + async getBehaviorPermissionsRaw(requestParameters: GetBehaviorPermissionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getBehaviorPermissionsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GetBehaviorPermissionsResponseFromJSON(jsonValue)); } @@ -76,9 +84,9 @@ export class BehaviorApi extends runtime.BaseAPI { } /** - * Get the type of behavior + * Creates request options for getBehaviorType without sending the request */ - async getBehaviorTypeRaw(requestParameters: GetBehaviorTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getBehaviorTypeRequestOpts(requestParameters: GetBehaviorTypeRequest): Promise { if (requestParameters['behaviorId'] == null) { throw new runtime.RequiredError( 'behaviorId', @@ -94,12 +102,20 @@ export class BehaviorApi extends runtime.BaseAPI { let urlPath = `/fake_behavior/{behavior-id}/type`; urlPath = urlPath.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters['behaviorId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get the type of behavior + */ + async getBehaviorTypeRaw(requestParameters: GetBehaviorTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getBehaviorTypeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GetBehaviorTypeResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts index fff5fd90fedc..33583194ba17 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts @@ -97,9 +97,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['dummyCat'] == null) { throw new runtime.RequiredError( 'dummyCat', @@ -121,13 +121,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: CategoryToJSON(requestParameters['dummyCat']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -140,9 +148,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -167,12 +175,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -185,11 +201,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple ids can be provided with comma separated strings. - * Finds Pets by ids + * Creates request options for findPetsByIds without sending the request * @deprecated */ - async findPetsByIdsRaw(requestParameters: FindPetsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByIdsRequestOpts(requestParameters: FindPetsByIdsRequest): Promise { if (requestParameters['ids'] == null) { throw new runtime.RequiredError( 'ids', @@ -213,12 +228,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByIds`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple ids can be provided with comma separated strings. + * Finds Pets by ids + * @deprecated + */ + async findPetsByIdsRaw(requestParameters: FindPetsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByIdsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -234,10 +259,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -261,12 +285,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FindPetsByStatusResponseFromJSON(jsonValue)); } @@ -281,11 +314,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -309,12 +341,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -330,11 +372,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple ids can be provided with comma separated strings. - * Finds Pets by user ids + * Creates request options for findPetsByUserIds without sending the request * @deprecated */ - async findPetsByUserIdsRaw(requestParameters: FindPetsByUserIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async findPetsByUserIdsRequestOpts(requestParameters: FindPetsByUserIdsRequest): Promise { if (requestParameters['ids'] == null) { throw new runtime.RequiredError( 'ids', @@ -358,12 +399,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByUserIds`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple ids can be provided with comma separated strings. + * Finds Pets by user ids + * @deprecated + */ + async findPetsByUserIdsRaw(requestParameters: FindPetsByUserIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.findPetsByUserIdsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FindPetsByUserResponseFromJSON(jsonValue)); } @@ -379,10 +430,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -402,12 +452,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -422,9 +481,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Gets regions for a single pet. + * Creates request options for getPetRegions without sending the request */ - async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetRegionsRequestOpts(requestParameters: GetPetRegionsRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -440,12 +499,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/regions`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Gets regions for a single pet. + */ + async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetRegionsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue)); } @@ -459,9 +526,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -483,13 +550,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -502,9 +577,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates the pet regions. + * Creates request options for updatePetRegions without sending the request */ - async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRegionsRequestOpts(requestParameters: UpdatePetRegionsRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -529,13 +604,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/regions`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters['newRegions'], - }, initOverrides); + }; + } + + /** + * Updates the pet regions. + */ + async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRegionsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue)); } @@ -549,9 +632,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -594,13 +677,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -613,9 +704,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -660,13 +751,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts index 4cb50b198310..d2988d06445d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts @@ -44,9 +44,9 @@ export interface GetMatchingPartsRequest { export class PetPartApi extends runtime.BaseAPI { /** - * Returns single pet part type for the petPart id. + * Creates request options for getFakePetPartType without sending the request */ - async getFakePetPartTypeRaw(requestParameters: GetFakePetPartTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getFakePetPartTypeRequestOpts(requestParameters: GetFakePetPartTypeRequest): Promise { if (requestParameters['fakePetPartId'] == null) { throw new runtime.RequiredError( 'fakePetPartId', @@ -62,12 +62,20 @@ export class PetPartApi extends runtime.BaseAPI { let urlPath = `/fake_petParts/{fake_petPart-id}/part-type`; urlPath = urlPath.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters['fakePetPartId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns single pet part type for the petPart id. + */ + async getFakePetPartTypeRaw(requestParameters: GetFakePetPartTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getFakePetPartTypeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GetPetPartTypeResponseFromJSON(jsonValue)); } @@ -81,9 +89,9 @@ export class PetPartApi extends runtime.BaseAPI { } /** - * Get the matching parts for the given pet part. + * Creates request options for getMatchingParts without sending the request */ - async getMatchingPartsRaw(requestParameters: GetMatchingPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getMatchingPartsRequestOpts(requestParameters: GetMatchingPartsRequest): Promise { if (requestParameters['fakePetPartId'] == null) { throw new runtime.RequiredError( 'fakePetPartId', @@ -140,12 +148,20 @@ export class PetPartApi extends runtime.BaseAPI { let urlPath = `/fake_petParts/{fake_petPart-id}/matching-parts`; urlPath = urlPath.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters['fakePetPartId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get the matching parts for the given pet part. + */ + async getMatchingPartsRaw(requestParameters: GetMatchingPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getMatchingPartsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GetMatchingPartsResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts index b3a1f18a31ce..ae3154c8ffad 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts index 3c7d7dd91a53..eaa4dd9ddcf2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts @@ -61,10 +61,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -81,13 +80,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -101,9 +109,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -120,13 +128,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -139,9 +155,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -158,13 +174,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -177,10 +201,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -196,12 +219,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -215,9 +247,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -233,12 +265,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -252,9 +292,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -284,12 +324,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -307,9 +355,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -317,12 +365,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -335,10 +391,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -363,13 +418,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DefaultMetaOnlyResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts index f5ba5857f5c5..9a60e65c5dcb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts @@ -32,10 +32,9 @@ export interface 123testSpecialTagsRequest { export class AnotherFakeApi extends runtime.BaseAPI { /** - * To test special tags and operation ID starting with number - * To test special tags + * Creates request options for _123testSpecialTags without sending the request */ - async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async _123testSpecialTagsRequestOpts(requestParameters: 123testSpecialTagsRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -52,13 +51,22 @@ export class AnotherFakeApi extends runtime.BaseAPI { let urlPath = `/another-fake/dummy`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + */ + async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this._123testSpecialTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/DefaultApi.ts index ce1e24dc07f2..7d65d746446a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/DefaultApi.ts @@ -28,8 +28,9 @@ import { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for fooGet without sending the request */ - async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fooGetRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -37,12 +38,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/foo`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fooGetRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FooGetDefaultResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts index 21ad0984b848..23383d77cbdb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts @@ -152,9 +152,9 @@ export interface TestQueryParameterCollectionFormatRequest { export class FakeApi extends runtime.BaseAPI { /** - * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * Creates request options for fakeBigDecimalMap without sending the request */ - async fakeBigDecimalMapRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeBigDecimalMapRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -162,12 +162,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/BigDecimalMap`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + async fakeBigDecimalMapRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeBigDecimalMapRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeBigDecimalMap200ResponseFromJSON(jsonValue)); } @@ -181,9 +189,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Health check endpoint + * Creates request options for fakeHealthGet without sending the request */ - async fakeHealthGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeHealthGetRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -191,12 +199,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/health`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Health check endpoint + */ + async fakeHealthGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeHealthGetRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => HealthCheckResultFromJSON(jsonValue)); } @@ -210,9 +226,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * test http signature authentication + * Creates request options for fakeHttpSignatureTest without sending the request */ - async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeHttpSignatureTestRequestOpts(requestParameters: FakeHttpSignatureTestRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -237,13 +253,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/http-signature-test`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * test http signature authentication + */ + async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeHttpSignatureTestRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -256,9 +280,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer boolean types + * Creates request options for fakeOuterBooleanSerialize without sending the request */ - async fakeOuterBooleanSerializeRaw(requestParameters: FakeOuterBooleanSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterBooleanSerializeRequestOpts(requestParameters: FakeOuterBooleanSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -268,13 +292,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/boolean`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer boolean types + */ + async fakeOuterBooleanSerializeRaw(requestParameters: FakeOuterBooleanSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterBooleanSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -292,9 +324,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of object with outer number type + * Creates request options for fakeOuterCompositeSerialize without sending the request */ - async fakeOuterCompositeSerializeRaw(requestParameters: FakeOuterCompositeSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterCompositeSerializeRequestOpts(requestParameters: FakeOuterCompositeSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -304,13 +336,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/composite`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OuterCompositeToJSON(requestParameters['outerComposite']), - }, initOverrides); + }; + } + + /** + * Test serialization of object with outer number type + */ + async fakeOuterCompositeSerializeRaw(requestParameters: FakeOuterCompositeSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterCompositeSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterCompositeFromJSON(jsonValue)); } @@ -324,9 +364,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer number types + * Creates request options for fakeOuterNumberSerialize without sending the request */ - async fakeOuterNumberSerializeRaw(requestParameters: FakeOuterNumberSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterNumberSerializeRequestOpts(requestParameters: FakeOuterNumberSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -336,13 +376,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/number`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer number types + */ + async fakeOuterNumberSerializeRaw(requestParameters: FakeOuterNumberSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterNumberSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -360,9 +408,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of outer string types + * Creates request options for fakeOuterStringSerialize without sending the request */ - async fakeOuterStringSerializeRaw(requestParameters: FakeOuterStringSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeOuterStringSerializeRequestOpts(requestParameters: FakeOuterStringSerializeRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -372,13 +420,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/outer/string`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * Test serialization of outer string types + */ + async fakeOuterStringSerializeRaw(requestParameters: FakeOuterStringSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeOuterStringSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -396,9 +452,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Test serialization of enum (int) properties with examples + * Creates request options for fakePropertyEnumIntegerSerialize without sending the request */ - async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakePropertyEnumIntegerSerializeRequestOpts(requestParameters: FakePropertyEnumIntegerSerializeRequest): Promise { if (requestParameters['outerObjectWithEnumProperty'] == null) { throw new runtime.RequiredError( 'outerObjectWithEnumProperty', @@ -415,13 +471,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/property/enum-int`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OuterObjectWithEnumPropertyToJSON(requestParameters['outerObjectWithEnumProperty']), - }, initOverrides); + }; + } + + /** + * Test serialization of enum (int) properties with examples + */ + async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakePropertyEnumIntegerSerializeRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterObjectWithEnumPropertyFromJSON(jsonValue)); } @@ -435,9 +499,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * For this test, the body has to be a binary file. + * Creates request options for testBodyWithBinary without sending the request */ - async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithBinaryRequestOpts(requestParameters: TestBodyWithBinaryRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -454,13 +518,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-binary`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, - }, initOverrides); + }; + } + + /** + * For this test, the body has to be a binary file. + */ + async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithBinaryRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -473,9 +545,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * For this test, the body for this request must reference a schema named `File`. + * Creates request options for testBodyWithFileSchema without sending the request */ - async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithFileSchemaRequestOpts(requestParameters: TestBodyWithFileSchemaRequest): Promise { if (requestParameters['fileSchemaTestClass'] == null) { throw new runtime.RequiredError( 'fileSchemaTestClass', @@ -492,13 +564,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-file-schema`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: FileSchemaTestClassToJSON(requestParameters['fileSchemaTestClass']), - }, initOverrides); + }; + } + + /** + * For this test, the body for this request must reference a schema named `File`. + */ + async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithFileSchemaRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -511,8 +591,9 @@ export class FakeApi extends runtime.BaseAPI { } /** + * Creates request options for testBodyWithQueryParams without sending the request */ - async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testBodyWithQueryParamsRequestOpts(requestParameters: TestBodyWithQueryParamsRequest): Promise { if (requestParameters['query'] == null) { throw new runtime.RequiredError( 'query', @@ -540,13 +621,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/body-with-query-params`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + */ + async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testBodyWithQueryParamsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -558,10 +646,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test \"client\" model - * To test \"client\" model + * Creates request options for testClientModel without sending the request */ - async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testClientModelRequestOpts(requestParameters: TestClientModelRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -578,13 +665,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test \"client\" model + * To test \"client\" model + */ + async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testClientModelRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } @@ -599,10 +695,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Creates request options for testEndpointParameters without sending the request */ - async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testEndpointParametersRequestOpts(requestParameters: TestEndpointParametersRequest): Promise { if (requestParameters['number'] == null) { throw new runtime.RequiredError( 'number', @@ -713,13 +808,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + */ + async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testEndpointParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -733,10 +837,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test enum parameters - * To test enum parameters + * Creates request options for testEnumParameters without sending the request */ - async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testEnumParametersRequestOpts(requestParameters: TestEnumParametersRequest): Promise { const queryParameters: any = {}; if (requestParameters['enumQueryStringArray'] != null) { @@ -794,13 +897,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * To test enum parameters + * To test enum parameters + */ + async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testEnumParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -814,10 +926,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * Fake endpoint to test group parameters (optional) - * Fake endpoint to test group parameters (optional) + * Creates request options for testGroupParameters without sending the request */ - async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testGroupParametersRequestOpts(requestParameters: TestGroupParametersRequest): Promise { if (requestParameters['requiredStringGroup'] == null) { throw new runtime.RequiredError( 'requiredStringGroup', @@ -878,12 +989,21 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake`; - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + */ + async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testGroupParametersRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -897,10 +1017,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test inline additionalProperties + * Creates request options for testInlineAdditionalProperties without sending the request */ - async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testInlineAdditionalPropertiesRequestOpts(requestParameters: TestInlineAdditionalPropertiesRequest): Promise { if (requestParameters['requestBody'] == null) { throw new runtime.RequiredError( 'requestBody', @@ -917,13 +1036,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/inline-additionalProperties`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['requestBody'], - }, initOverrides); + }; + } + + /** + * + * test inline additionalProperties + */ + async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testInlineAdditionalPropertiesRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -937,10 +1065,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * - * test json serialization of form data + * Creates request options for testJsonFormData without sending the request */ - async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testJsonFormDataRequestOpts(requestParameters: TestJsonFormDataRequest): Promise { if (requestParameters['param'] == null) { throw new runtime.RequiredError( 'param', @@ -984,13 +1111,22 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/jsonFormData`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * test json serialization of form data + */ + async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testJsonFormDataRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -1004,9 +1140,9 @@ export class FakeApi extends runtime.BaseAPI { } /** - * To test the collection format in query parameters + * Creates request options for testQueryParameterCollectionFormat without sending the request */ - async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testQueryParameterCollectionFormatRequestOpts(requestParameters: TestQueryParameterCollectionFormatRequest): Promise { if (requestParameters['pipe'] == null) { throw new runtime.RequiredError( 'pipe', @@ -1086,12 +1222,20 @@ export class FakeApi extends runtime.BaseAPI { let urlPath = `/fake/test-query-parameters`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * To test the collection format in query parameters + */ + async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testQueryParameterCollectionFormatRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts index cdefdb8e7951..9dfcce8210eb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts @@ -32,10 +32,9 @@ export interface TestClassnameRequest { export class FakeClassnameTags123Api extends runtime.BaseAPI { /** - * To test class name in snake case - * To test class name in snake case + * Creates request options for testClassname without sending the request */ - async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async testClassnameRequestOpts(requestParameters: TestClassnameRequest): Promise { if (requestParameters['client'] == null) { throw new runtime.RequiredError( 'client', @@ -56,13 +55,22 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { let urlPath = `/fake_classname_test`; - const response = await this.request({ + return { path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: ClientToJSON(requestParameters['client']), - }, initOverrides); + }; + } + + /** + * To test class name in snake case + * To test class name in snake case + */ + async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.testClassnameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts index 2a9812520139..6023f2567eeb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts @@ -74,10 +74,9 @@ export interface UploadFileWithRequiredFileRequest { export class PetApi extends runtime.BaseAPI { /** - * - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -99,13 +98,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -119,10 +127,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -147,12 +154,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -166,10 +182,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -193,12 +208,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -213,11 +237,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -241,12 +264,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => new Set(jsonValue.map(PetFromJSON))); } @@ -262,10 +295,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -285,12 +317,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -305,10 +346,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -330,13 +370,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -350,10 +399,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -396,13 +444,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -416,10 +473,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -464,13 +520,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } @@ -485,10 +550,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * uploads an image (required) + * Creates request options for uploadFileWithRequiredFile without sending the request */ - async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileWithRequiredFileRequestOpts(requestParameters: UploadFileWithRequiredFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -540,13 +604,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/fake/{petId}/uploadImageWithRequiredFile`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * uploads an image (required) + */ + async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileWithRequiredFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts index 3ba8c2cab723..3d4b3f1b0c46 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{order_id}`; urlPath = urlPath.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{order_id}`; urlPath = urlPath.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,10 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['order'] == null) { throw new runtime.RequiredError( 'order', @@ -172,13 +195,22 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['order']), - }, initOverrides); + }; + } + + /** + * + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts index 83a5374e23a5..029e2bea4d2b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,10 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -118,13 +125,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -138,10 +154,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -158,13 +173,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -178,10 +202,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -197,12 +220,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -216,10 +248,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -235,12 +266,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -255,10 +295,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -288,12 +327,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -312,10 +360,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -323,12 +370,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -342,10 +398,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -370,13 +425,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/PetApi.ts index b66ef90918b5..fa8cec4ceea6 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/PetApi.ts @@ -68,10 +68,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -93,13 +92,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -114,10 +122,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -142,12 +149,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -161,10 +177,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -188,12 +203,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -208,11 +232,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -236,12 +259,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -257,10 +290,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -280,12 +312,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -300,10 +341,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['pet'] == null) { throw new runtime.RequiredError( 'pet', @@ -325,13 +365,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['pet']), - }, initOverrides); + }; + } + + /** + * + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -346,10 +395,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -392,13 +440,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -412,10 +469,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -460,13 +516,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/StoreApi.ts index 7f1528fdb2cb..06fb6b1c2ca6 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,10 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['order'] == null) { throw new runtime.RequiredError( 'order', @@ -172,13 +195,22 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['order']), - }, initOverrides); + }; + } + + /** + * + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/UserApi.ts index 756c61cbee4a..c0eb473d38a3 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -82,13 +81,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -102,10 +110,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -126,13 +133,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -146,10 +162,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['user'] == null) { throw new runtime.RequiredError( 'user', @@ -170,13 +185,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['user']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -190,10 +214,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -213,12 +236,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -232,10 +264,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -251,12 +282,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -271,10 +311,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -304,12 +343,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -328,10 +376,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -343,12 +390,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -362,10 +418,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -394,13 +449,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['user']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index 316ff58281ed..d231ba57571b 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -69,6 +69,14 @@ export interface UploadFileRequest { * @interface PetApiInterface */ export interface PetApiInterface { + /** + * Creates request options for addPet without sending the request + * @param {Pet} body Pet object that needs to be added to the store + * @throws {RequiredError} + * @memberof PetApiInterface + */ + addPetRequestOpts(requestParameters: AddPetRequest): Promise; + /** * * @summary Add a new pet to the store @@ -84,6 +92,15 @@ export interface PetApiInterface { */ addPet(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for deletePet without sending the request + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @throws {RequiredError} + * @memberof PetApiInterface + */ + deletePetRequestOpts(requestParameters: DeletePetRequest): Promise; + /** * * @summary Deletes a pet @@ -100,6 +117,14 @@ export interface PetApiInterface { */ deletePet(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for findPetsByStatus without sending the request + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @throws {RequiredError} + * @memberof PetApiInterface + */ + findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise; + /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status @@ -116,6 +141,15 @@ export interface PetApiInterface { */ findPetsByStatus(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + /** + * Creates request options for findPetsByTags without sending the request + * @param {Array} tags Tags to filter by + * @deprecated + * @throws {RequiredError} + * @memberof PetApiInterface + */ + findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise; + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -134,6 +168,14 @@ export interface PetApiInterface { */ findPetsByTags(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + /** + * Creates request options for getPetById without sending the request + * @param {number} petId ID of pet to return + * @throws {RequiredError} + * @memberof PetApiInterface + */ + getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise; + /** * Returns a single pet * @summary Find pet by ID @@ -150,6 +192,14 @@ export interface PetApiInterface { */ getPetById(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for updatePet without sending the request + * @param {Pet} body Pet object that needs to be added to the store + * @throws {RequiredError} + * @memberof PetApiInterface + */ + updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise; + /** * * @summary Update an existing pet @@ -165,6 +215,16 @@ export interface PetApiInterface { */ updatePet(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for updatePetWithForm without sending the request + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @throws {RequiredError} + * @memberof PetApiInterface + */ + updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise; + /** * * @summary Updates a pet in the store with form data @@ -182,6 +242,16 @@ export interface PetApiInterface { */ updatePetWithForm(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for uploadFile without sending the request + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {Blob} [file] file to upload + * @throws {RequiredError} + * @memberof PetApiInterface + */ + uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise; + /** * * @summary uploads an image @@ -207,9 +277,9 @@ export interface PetApiInterface { export class PetApi extends runtime.BaseAPI implements PetApiInterface { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -231,13 +301,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -250,9 +328,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -277,12 +355,20 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -295,10 +381,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -322,12 +407,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -342,11 +436,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -370,12 +463,22 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -391,10 +494,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -414,12 +516,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -434,9 +545,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -458,13 +569,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -477,9 +596,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -522,13 +641,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -541,9 +668,9 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -588,13 +715,21 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts index 770ac98198bc..2f33ed6b1254 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts @@ -41,6 +41,14 @@ export interface PlaceOrderRequest { * @interface StoreApiInterface */ export interface StoreApiInterface { + /** + * Creates request options for deleteOrder without sending the request + * @param {string} orderId ID of the order that needs to be deleted + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise; + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID @@ -57,6 +65,13 @@ export interface StoreApiInterface { */ deleteOrder(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for getInventory without sending the request + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + getInventoryRequestOpts(): Promise; + /** * Returns a map of status codes to quantities * @summary Returns pet inventories by status @@ -72,6 +87,14 @@ export interface StoreApiInterface { */ getInventory(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: number; }>; + /** + * Creates request options for getOrderById without sending the request + * @param {number} orderId ID of pet that needs to be fetched + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise; + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * @summary Find purchase order by ID @@ -88,6 +111,14 @@ export interface StoreApiInterface { */ getOrderById(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for placeOrder without sending the request + * @param {Order} body order placed for purchasing the pet + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise; + /** * * @summary Place an order for a pet @@ -111,10 +142,9 @@ export interface StoreApiInterface { export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -130,12 +160,21 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -149,10 +188,9 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -164,12 +202,21 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -184,10 +231,9 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -203,12 +249,21 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -223,9 +278,9 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -242,13 +297,21 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts index 83ee5cedbbfb..3346ad9825ef 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts @@ -59,6 +59,14 @@ export interface UpdateUserRequest { * @interface UserApiInterface */ export interface UserApiInterface { + /** + * Creates request options for createUser without sending the request + * @param {User} body Created user object + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUserRequestOpts(requestParameters: CreateUserRequest): Promise; + /** * This can only be done by the logged in user. * @summary Create user @@ -75,6 +83,14 @@ export interface UserApiInterface { */ createUser(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for createUsersWithArrayInput without sending the request + * @param {Array} body List of user object + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise; + /** * * @summary Creates list of users with given input array @@ -90,6 +106,14 @@ export interface UserApiInterface { */ createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for createUsersWithListInput without sending the request + * @param {Array} body List of user object + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise; + /** * * @summary Creates list of users with given input array @@ -105,6 +129,14 @@ export interface UserApiInterface { */ createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for deleteUser without sending the request + * @param {string} username The name that needs to be deleted + * @throws {RequiredError} + * @memberof UserApiInterface + */ + deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise; + /** * This can only be done by the logged in user. * @summary Delete user @@ -121,6 +153,14 @@ export interface UserApiInterface { */ deleteUser(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for getUserByName without sending the request + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise; + /** * * @summary Get user by user name @@ -136,6 +176,15 @@ export interface UserApiInterface { */ getUserByName(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for loginUser without sending the request + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @throws {RequiredError} + * @memberof UserApiInterface + */ + loginUserRequestOpts(requestParameters: LoginUserRequest): Promise; + /** * * @summary Logs user into the system @@ -152,6 +201,13 @@ export interface UserApiInterface { */ loginUser(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for logoutUser without sending the request + * @throws {RequiredError} + * @memberof UserApiInterface + */ + logoutUserRequestOpts(): Promise; + /** * * @summary Logs out current logged in user session @@ -166,6 +222,15 @@ export interface UserApiInterface { */ logoutUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * Creates request options for updateUser without sending the request + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @throws {RequiredError} + * @memberof UserApiInterface + */ + updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise; + /** * This can only be done by the logged in user. * @summary Updated user @@ -191,10 +256,9 @@ export interface UserApiInterface { export class UserApi extends runtime.BaseAPI implements UserApiInterface { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -211,13 +275,22 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -231,9 +304,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -250,13 +323,21 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -269,9 +350,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -288,13 +369,21 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -307,10 +396,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -326,12 +414,21 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -345,9 +442,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -363,12 +460,20 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -382,9 +487,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -414,12 +519,20 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -437,9 +550,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -447,12 +560,20 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -465,10 +586,9 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -493,13 +613,22 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 586438f033c4..360d2bff6ebc 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -68,9 +68,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -92,13 +92,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -111,9 +119,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -138,12 +146,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -156,10 +172,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -183,12 +198,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -203,11 +227,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -231,12 +254,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON)); } @@ -252,10 +285,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -275,12 +307,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue)); } @@ -295,9 +336,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -319,13 +360,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: PetToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -338,9 +387,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -383,13 +432,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -402,9 +459,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -449,13 +506,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts index 0bcfdbf84600..71133d29c3d1 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts @@ -40,10 +40,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -59,12 +58,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -78,10 +86,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -93,12 +100,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -113,10 +129,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -132,12 +147,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } @@ -152,9 +176,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -171,13 +195,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: OrderToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts index 43799227666d..9240a2473288 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts @@ -58,10 +58,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -78,13 +77,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -98,9 +106,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -117,13 +125,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -136,9 +152,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -155,13 +171,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body']!.map(UserToJSON), - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -174,10 +198,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -193,12 +216,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -212,9 +244,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -230,12 +262,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UserFromJSON(jsonValue)); } @@ -249,9 +289,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -281,12 +321,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -304,9 +352,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -314,12 +362,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,10 +388,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -360,13 +415,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: UserToJSON(requestParameters['body']), - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts index 730f0a062006..461a71a66b89 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts @@ -59,8 +59,9 @@ export interface FakeEnumRequestPostRefRequest { export class DefaultApi extends runtime.BaseAPI { /** + * Creates request options for fakeEnumRequestGetInline without sending the request */ - async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestGetInlineRequestOpts(requestParameters: FakeEnumRequestGetInlineRequest): Promise { const queryParameters: any = {}; if (requestParameters['stringEnum'] != null) { @@ -84,12 +85,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-inline`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestGetInlineRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } @@ -102,8 +110,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestGetRef without sending the request */ - async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestGetRefRequestOpts(requestParameters: FakeEnumRequestGetRefRequest): Promise { const queryParameters: any = {}; if (requestParameters['stringEnum'] != null) { @@ -127,12 +136,19 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-ref`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestGetRefRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); } @@ -145,8 +161,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestPostInline without sending the request */ - async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestPostInlineRequestOpts(requestParameters: FakeEnumRequestPostInlineRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -156,13 +173,20 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-inline`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters['fakeEnumRequestGetInline200Response']), - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestPostInlineRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } @@ -175,8 +199,9 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * Creates request options for fakeEnumRequestPostRef without sending the request */ - async fakeEnumRequestPostRefRaw(requestParameters: FakeEnumRequestPostRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async fakeEnumRequestPostRefRequestOpts(requestParameters: FakeEnumRequestPostRefRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -186,13 +211,20 @@ export class DefaultApi extends runtime.BaseAPI { let urlPath = `/fake/enum-request-ref`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: EnumPatternObjectToJSON(requestParameters['enumPatternObject']), - }, initOverrides); + }; + } + + /** + */ + async fakeEnumRequestPostRefRaw(requestParameters: FakeEnumRequestPostRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.fakeEnumRequestPostRefRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts index accc88ffc8a7..ff76faf1911b 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts @@ -62,9 +62,9 @@ export interface UploadFileRequest { export class PetApi extends runtime.BaseAPI { /** - * Add a new pet to the store + * Creates request options for addPet without sending the request */ - async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPetRequestOpts(requestParameters: AddPetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -86,13 +86,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * Add a new pet to the store + */ + async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -105,9 +113,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Deletes a pet + * Creates request options for deletePet without sending the request */ - async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -132,12 +140,20 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Deletes a pet + */ + async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -150,10 +166,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple status values can be provided with comma separated strings - * Finds Pets by status + * Creates request options for findPetsByStatus without sending the request */ - async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise { if (requestParameters['status'] == null) { throw new runtime.RequiredError( 'status', @@ -177,12 +192,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByStatus`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + */ + async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -197,11 +221,10 @@ export class PetApi extends runtime.BaseAPI { } /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Finds Pets by tags + * Creates request options for findPetsByTags without sending the request * @deprecated */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise { if (requestParameters['tags'] == null) { throw new runtime.RequiredError( 'tags', @@ -225,12 +248,22 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/findByTags`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @deprecated + */ + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -246,10 +279,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Returns a single pet - * Find pet by ID + * Creates request options for getPetById without sending the request */ - async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -269,12 +301,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a single pet + * Find pet by ID + */ + async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getPetByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -289,9 +330,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Update an existing pet + * Creates request options for updatePet without sending the request */ - async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -313,13 +354,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet`; - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * Update an existing pet + */ + async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -332,9 +381,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * Updates a pet in the store with form data + * Creates request options for updatePetWithForm without sending the request */ - async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -377,13 +426,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * Updates a pet in the store with form data + */ + async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -396,9 +453,9 @@ export class PetApi extends runtime.BaseAPI { } /** - * uploads an image + * Creates request options for uploadFile without sending the request */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise { if (requestParameters['petId'] == null) { throw new runtime.RequiredError( 'petId', @@ -443,13 +500,21 @@ export class PetApi extends runtime.BaseAPI { let urlPath = `/pet/{petId}/uploadImage`; urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, - }, initOverrides); + }; + } + + /** + * uploads an image + */ + async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.uploadFileRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts index e650674e0cdf..da0c7d75eb9d 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts @@ -36,10 +36,9 @@ export interface PlaceOrderRequest { export class StoreApi extends runtime.BaseAPI { /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Delete purchase order by ID + * Creates request options for deleteOrder without sending the request */ - async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteOrderRequestOpts(requestParameters: DeleteOrderRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -55,12 +54,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + */ + async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -74,10 +82,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Returns a map of status codes to quantities - * Returns pet inventories by status + * Creates request options for getInventory without sending the request */ - async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getInventoryRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -89,12 +96,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/inventory`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + async getInventoryRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getInventoryRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -109,10 +125,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * Find purchase order by ID + * Creates request options for getOrderById without sending the request */ - async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getOrderByIdRequestOpts(requestParameters: GetOrderByIdRequest): Promise { if (requestParameters['orderId'] == null) { throw new runtime.RequiredError( 'orderId', @@ -128,12 +143,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order/{orderId}`; urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + */ + async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getOrderByIdRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -148,9 +172,9 @@ export class StoreApi extends runtime.BaseAPI { } /** - * Place an order for a pet + * Creates request options for placeOrder without sending the request */ - async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async placeOrderRequestOpts(requestParameters: PlaceOrderRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -167,13 +191,21 @@ export class StoreApi extends runtime.BaseAPI { let urlPath = `/store/order`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * Place an order for a pet + */ + async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.placeOrderRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts index 90c8a3d4362f..32183a9e7c9b 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts @@ -54,10 +54,9 @@ export interface UpdateUserRequest { export class UserApi extends runtime.BaseAPI { /** - * This can only be done by the logged in user. - * Create user + * Creates request options for createUser without sending the request */ - async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUserRequestOpts(requestParameters: CreateUserRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -74,13 +73,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Create user + */ + async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -94,9 +102,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithArrayInput without sending the request */ - async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithArrayInputRequestOpts(requestParameters: CreateUsersWithArrayInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -113,13 +121,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithArray`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithArrayInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -132,9 +148,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Creates list of users with given input array + * Creates request options for createUsersWithListInput without sending the request */ - async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createUsersWithListInputRequestOpts(requestParameters: CreateUsersWithListInputRequest): Promise { if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', @@ -151,13 +167,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/createWithList`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * Creates list of users with given input array + */ + async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createUsersWithListInputRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -170,10 +194,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Delete user + * Creates request options for deleteUser without sending the request */ - async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteUserRequestOpts(requestParameters: DeleteUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -189,12 +212,21 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Delete user + */ + async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -208,9 +240,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Get user by user name + * Creates request options for getUserByName without sending the request */ - async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUserByNameRequestOpts(requestParameters: GetUserByNameRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -226,12 +258,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get user by user name + */ + async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getUserByNameRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response); } @@ -245,9 +285,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs user into the system + * Creates request options for loginUser without sending the request */ - async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async loginUserRequestOpts(requestParameters: LoginUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -277,12 +317,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/login`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs user into the system + */ + async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.loginUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); @@ -300,9 +348,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * Logs out current logged in user session + * Creates request options for logoutUser without sending the request */ - async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async logoutUserRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -310,12 +358,20 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/logout`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Logs out current logged in user session + */ + async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.logoutUserRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -328,10 +384,9 @@ export class UserApi extends runtime.BaseAPI { } /** - * This can only be done by the logged in user. - * Updated user + * Creates request options for updateUser without sending the request */ - async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateUserRequestOpts(requestParameters: UpdateUserRequest): Promise { if (requestParameters['username'] == null) { throw new runtime.RequiredError( 'username', @@ -356,13 +411,22 @@ export class UserApi extends runtime.BaseAPI { let urlPath = `/user/{username}`; urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))); - const response = await this.request({ + return { path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters['body'], - }, initOverrides); + }; + } + + /** + * This can only be done by the logged in user. + * Updated user + */ + async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.updateUserRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/samples/documentation/html/.openapi-generator/VERSION b/samples/documentation/html/.openapi-generator/VERSION index 4b448de535c7..193a12d6e891 100644 --- a/samples/documentation/html/.openapi-generator/VERSION +++ b/samples/documentation/html/.openapi-generator/VERSION @@ -1 +1 @@ -5.3.0-SNAPSHOT \ No newline at end of file +7.20.0-SNAPSHOT diff --git a/samples/documentation/html/index.html b/samples/documentation/html/index.html index c03786480365..81a6253d5e79 100644 --- a/samples/documentation/html/index.html +++ b/samples/documentation/html/index.html @@ -189,8 +189,8 @@

OpenAPI Petstore

https://www.apache.org/licenses/LICENSE-2.0.html

Access

    -
  1. APIKey KeyParamName:api_key KeyInQuery:false KeyInHeader:true
  2. OAuth AuthorizationUrl:http://petstore.swagger.io/api/oauth/dialogTokenUrl:
  3. +
  4. APIKey KeyParamName:api_key KeyInQuery:false KeyInHeader:true

Methods

@@ -286,11 +286,19 @@

Example data

Content-Type: application/xml

   123456789
+  
+    123456789
+    aeiou
+  
   doggie
   
     aeiou
   
   
+    
+      123456789
+      aeiou
+    
   
   aeiou
 
@@ -378,7 +386,7 @@

Return type

Example data

Content-Type: application/json
-
{
+    
[ {
   "photoUrls" : [ "photoUrls", "photoUrls" ],
   "name" : "doggie",
   "id" : 0,
@@ -394,16 +402,40 @@ 

Example data

"id" : 1 } ], "status" : "available" -}
+}, { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} ]

Example data

Content-Type: application/xml

   123456789
+  
+    123456789
+    aeiou
+  
   doggie
   
     aeiou
   
   
+    
+      123456789
+      aeiou
+    
   
   aeiou
 
@@ -454,7 +486,7 @@

Return type

Example data

Content-Type: application/json
-
{
+    
[ {
   "photoUrls" : [ "photoUrls", "photoUrls" ],
   "name" : "doggie",
   "id" : 0,
@@ -470,16 +502,40 @@ 

Example data

"id" : 1 } ], "status" : "available" -}
+}, { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} ]

Example data

Content-Type: application/xml

   123456789
+  
+    123456789
+    aeiou
+  
   doggie
   
     aeiou
   
   
+    
+      123456789
+      aeiou
+    
   
   aeiou
 
@@ -551,11 +607,19 @@

Example data

Content-Type: application/xml

   123456789
+  
+    123456789
+    aeiou
+  
   doggie
   
     aeiou
   
   
+    
+      123456789
+      aeiou
+    
   
   aeiou
 
@@ -1034,7 +1098,7 @@

Consumes

Request body

-
User User (required)
+
User array[User] (required)
Body Parameter
@@ -1070,7 +1134,7 @@

Consumes

Request body

-
User User (required)
+
User array[User] (required)
Body Parameter
diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index c71b19bf2895..91bd0b2c2c37 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -162,6 +162,7 @@ export class SelfDecodingBody implements ResponseBody { const data: Blob = await this.dataSource; return data.text(); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index c71b19bf2895..91bd0b2c2c37 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -162,6 +162,7 @@ export class SelfDecodingBody implements ResponseBody { const data: Blob = await this.dataSource; return data.text(); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index 39da9e077230..1626038a1bcf 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index db24c4927063..a4ca7586e06b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/server/petstore/python-fastapi/requirements.txt b/samples/server/petstore/python-fastapi/requirements.txt index a71e60352a38..8e0fe46861eb 100644 --- a/samples/server/petstore/python-fastapi/requirements.txt +++ b/samples/server/petstore/python-fastapi/requirements.txt @@ -22,7 +22,7 @@ orjson==3.9.15 promise==2.3 pydantic>=2 python-dotenv==0.17.1 -python-multipart==0.0.18 +python-multipart==0.0.22 PyYAML>=5.4.1,<6.1.0 requests==2.32.4 Rx==1.6.1