diff --git a/docs/faq-generators.md b/docs/faq-generators.md index 7a69dd8723a..0fd6b5d2a96 100644 --- a/docs/faq-generators.md +++ b/docs/faq-generators.md @@ -492,7 +492,7 @@ Here is a working sample that put's together all of this. - A new configuration, `apiStaticMethod`, allows you to use instance methods instead of class methods for API calls. For more information, check the sample project [apiNonStaticMethod](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift6/apiNonStaticMethod). - The new default response is based on async/await. To revert to the previous behavior, set the `responseAs` flag to `ObjcBlock`. - The default project structure now follows the SPM (Swift Package Manager) structure. To revert to the old structure, set the `useSPMFileStructure` flag to `false`. -- The former `{{projectName}}API` is now called `OpenAPIClient`. +- The former `{{projectName}}API` is now called `{{projectName}}APIConfiguration`. - You can now set a request interceptor and retrier by configuring `OpenAPIClient.shared.interceptor`, making authenticated requests easier to manage. ## TypeScript diff --git a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache index c0080c12ba2..ab285c102cf 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache @@ -15,7 +15,7 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{projectName}}API {} {{/swiftUseApiNamespace}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class OpenAPIClient: @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}}APIConfiguration: @unchecked Sendable { {{#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? @@ -79,7 +79,7 @@ import Alamofire{{/useAlamofire}} self.stringResponseSerializer = stringResponseSerializer{{/useAlamofire}}{{/useVapor}} } - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = OpenAPIClient() + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = {{projectName}}APIConfiguration() }{{^useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder: @unchecked Sendable { @@ -90,20 +90,20 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask() {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requiresAuthentication: Bool - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let openAPIClient: OpenAPIClient + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let apiConfiguration: {{projectName}}APIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> Void)? - required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -163,7 +163,7 @@ import Alamofire{{/useAlamofire}} } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } diff --git a/modules/openapi-generator/src/main/resources/swift6/_param.mustache b/modules/openapi-generator/src/main/resources/swift6/_param.mustache index 4ec0805b5e6..5b88c05ef6d 100644 --- a/modules/openapi-generator/src/main/resources/swift6/_param.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/_param.mustache @@ -1 +1 @@ -"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToJSON(codableHelper: openAPIClient.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}} \ No newline at end of file +"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToJSON(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift6/api.mustache b/modules/openapi-generator/src/main/resources/swift6/api.mustache index 9eecf88a575..8bd2521a1d4 100644 --- a/modules/openapi-generator/src/main/resources/swift6/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/api.mustache @@ -20,9 +20,9 @@ extension {{projectName}}API { /** {{{.}}} */{{/description}} {{#objcCompatible}}@objcMembers {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} { {{^apiStaticMethod}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let openAPIClient: OpenAPIClient - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let apiConfiguration: {{projectName}}APIConfiguration + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } {{/apiStaticMethod}} {{#operation}} @@ -60,15 +60,15 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - parameter completion: completion handler to receive the data and the error objects */ {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} @discardableResult - {{#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}}, {{/allParams}}{{#apiStaticMethod}}openAPIClient: OpenAPIClient = OpenAPIClient.shared, {{/apiStaticMethod}}completion: @Sendable @escaping (_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void) -> RequestTask { - return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}openAPIClient: openAPIClient{{/apiStaticMethod}}).execute { result in + {{#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}}, {{/allParams}}{{#apiStaticMethod}}apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, {{/apiStaticMethod}}completion: @Sendable @escaping (_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void) -> RequestTask { + return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}).execute { result in switch result { {{#returnType}} case let .success(response): @@ -91,15 +91,15 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - returns: Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> */ {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#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}}openAPIClient: OpenAPIClient = OpenAPIClient.shared{{/apiStaticMethod}}) -> Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#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}}) -> Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { let deferred = Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pending() - {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}openAPIClient: openAPIClient{{/apiStaticMethod}}).execute { result in + {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}).execute { result in switch result { {{#returnType}} case let .success(response): @@ -123,15 +123,15 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - returns: Observable<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> */ {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#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}}openAPIClient: OpenAPIClient = OpenAPIClient.shared{{/apiStaticMethod}}) -> Observable<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#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}}) -> Observable<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { return Observable.create { observer -> Disposable in - let requestTask = self.{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}openAPIClient: openAPIClient{{/apiStaticMethod}}).execute { result in + let requestTask = self.{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}).execute { result in switch result { {{#returnType}} case let .success(response): @@ -160,7 +160,7 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - returns: AnyPublisher<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> */ #if canImport(Combine) @@ -168,8 +168,8 @@ extension {{projectName}}API { @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}}openAPIClient: OpenAPIClient = OpenAPIClient.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}}openAPIClient: openAPIClient{{/apiStaticMethod}}) + {{#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 return {{#combineDeferred}}Deferred { {{/combineDeferred}}Future<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { promise in nonisolated(unsafe) let promise = promise @@ -206,15 +206,15 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - returns: {{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}} */ {{#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}}openAPIClient: OpenAPIClient = OpenAPIClient.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}}openAPIClient: openAPIClient{{/apiStaticMethod}}).execute().body + {{#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 } {{/useAsyncAwait}} {{#useResult}} @@ -224,15 +224,15 @@ extension {{projectName}}API { {{{.}}} {{/summary}}{{#allParams}} - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{{/apiStaticMethod}} + - parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}} - parameter completion: completion handler to receive the result */ {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} @discardableResult - {{#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}}, {{/allParams}}{{#apiStaticMethod}}openAPIClient: OpenAPIClient = OpenAPIClient.shared, {{/apiStaticMethod}}completion: @Sendable @escaping (_ result: Swift.Result<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void) -> RequestTask { - return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}openAPIClient: openAPIClient{{/apiStaticMethod}}).execute { result in + {{#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}}, {{/allParams}}{{#apiStaticMethod}}apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, {{/apiStaticMethod}}completion: @Sendable @escaping (_ result: Swift.Result<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void) -> RequestTask { + return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}apiConfiguration: apiConfiguration{{/apiStaticMethod}}).execute { result in switch result { {{#returnType}} case let .success(response): @@ -272,25 +272,25 @@ extension {{projectName}}API { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} {{#apiStaticMethod}} - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. {{/apiStaticMethod}} - returns: RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}} */ {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#apiStaticMethod}}{{#hasParams}}, {{/hasParams}}openAPIClient: OpenAPIClient = OpenAPIClient.shared{{/apiStaticMethod}}) -> RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}WithRequestBuilder({{#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}}) -> RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{#-first}}var{{/-first}}{{/pathParams}} localVariablePath = "{{{path}}}"{{#pathParams}} let {{paramName}}PreEscape = "\({{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}APIHelper.mapValueToPathItem({{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 = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath {{#bodyParam}} {{#isBinary}} let localVariableParameters = ["body": {{paramName}}] {{/isBinary}} {{^isBinary}} - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: {{paramName}}, codableHelper: openAPIClient.codableHelper) + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: {{paramName}}, codableHelper: apiConfiguration.codableHelper) {{/isBinary}} {{/bodyParam}} {{^bodyParam}} @@ -325,9 +325,9 @@ extension {{projectName}}API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = openAPIClient.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}} + let localVariableRequestBuilder: RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = apiConfiguration.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}} - return localVariableRequestBuilder.init(method: "{{httpMethod}}", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "{{httpMethod}}", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, apiConfiguration: apiConfiguration) } {{/useVapor}} {{#useVapor}} @@ -359,15 +359,15 @@ 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 = OpenAPIClient.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 = {{projectName}}APIConfiguration.shared.customHeaders, 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 = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.{{httpMethod}}, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -388,8 +388,8 @@ extension {{projectName}}API { } try localVariableRequest.query.encode(QueryParams({{#queryParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/queryParams}})){{/hasQueryParams}} {{#hasBodyParam}} - {{#bodyParam}}{{#required}}{{#isBinary}}localVariableRequest.body = ByteBuffer(data: {{paramName}}){{/isBinary}}{{^isBinary}}{{#isFile}}localVariableRequest.body = ByteBuffer(data: {{paramName}}){{/isFile}}try localVariableRequest.content.encode({{paramName}}, using: openAPIClient.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}}{{/required}}{{^required}}if let localVariableBody = {{paramName}} { - {{#isBinary}}localVariableRequest.body = ByteBuffer(data: localVariableBody){{/isBinary}}{{^isBinary}}{{#isFile}}localVariableRequest.body = ByteBuffer(data: localVariableBody){{/isFile}}try localVariableRequest.content.encode(localVariableBody, using: openAPIClient.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}} + {{#bodyParam}}{{#required}}{{#isBinary}}localVariableRequest.body = ByteBuffer(data: {{paramName}}){{/isBinary}}{{^isBinary}}{{#isFile}}localVariableRequest.body = ByteBuffer(data: {{paramName}}){{/isFile}}try localVariableRequest.content.encode({{paramName}}, using: apiConfiguration.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}}{{/required}}{{^required}}if let localVariableBody = {{paramName}} { + {{#isBinary}}localVariableRequest.body = ByteBuffer(data: localVariableBody){{/isBinary}}{{^isBinary}}{{#isFile}}localVariableRequest.body = ByteBuffer(data: localVariableBody){{/isFile}}try localVariableRequest.content.encode(localVariableBody, using: apiConfiguration.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}} }{{/required}}{{/bodyParam}} {{/hasBodyParam}} {{#hasFormParams}}struct FormParams: Content { @@ -398,7 +398,7 @@ extension {{projectName}}API { var {{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}} {{/formParams}} } - try localVariableRequest.content.encode(FormParams({{#formParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/formParams}}), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)){{/hasFormParams}} + try localVariableRequest.content.encode(FormParams({{#formParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/formParams}}), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)){{/hasFormParams}} try beforeSend(&localVariableRequest) } } @@ -439,12 +439,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { + {{#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 switch response.status.code { {{#responses}} {{#isDefault}}default{{/isDefault}}{{^isDefault}}case {{code}}{{/isDefault}}: - return .http{{code}}({{#dataType}}value: {{#isBinary}}Data(buffer: response.body ?? ByteBuffer()){{/isBinary}}{{^isBinary}}{{#isFile}}Data(buffer: response.body ?? ByteBuffer()){{/isFile}}{{^isFile}}try response.content.decode({{{dataType}}}.self, using: openAPIClient.contentConfiguration.requireDecoder(for: {{{dataType}}}.defaultContentType)){{/isFile}}{{/isBinary}}, {{/dataType}}raw: response) + return .http{{code}}({{#dataType}}value: {{#isBinary}}Data(buffer: response.body ?? ByteBuffer()){{/isBinary}}{{^isBinary}}{{#isFile}}Data(buffer: response.body ?? ByteBuffer()){{/isFile}}{{^isFile}}try response.content.decode({{{dataType}}}.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: {{{dataType}}}.defaultContentType)){{/isFile}}{{/isBinary}}, {{/dataType}}raw: response) {{/responses}} {{^hasDefaultResponse}} default: diff --git a/modules/openapi-generator/src/main/resources/swift6/api_doc.mustache b/modules/openapi-generator/src/main/resources/swift6/api_doc.mustache index 89459f09d81..9024673ab85 100644 --- a/modules/openapi-generator/src/main/resources/swift6/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/api_doc.mustache @@ -26,7 +26,7 @@ Method | HTTP request | Description {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Observable<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{/useRxSwift}} {{#useVapor}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/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}}> {{/useVapor}} ``` 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 94714b31bae..eadc9194823 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 @@ -28,8 +28,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @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]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, 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) } /** @@ -40,7 +40,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders = buildHeaders() return Alamofire.Session(configuration: configuration, - interceptor: openAPIClient.interceptor) + interceptor: apiConfiguration.interceptor) } /** @@ -172,12 +172,12 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -266,12 +266,12 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is String.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.stringResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.stringResponseSerializer, completionHandler: { stringResponse in cleanupRequest() @@ -284,8 +284,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { }) case is URL.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -332,8 +332,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { return }) case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -346,8 +346,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { }) case is Data.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -360,8 +360,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { }) default: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -384,7 +384,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { return } - let decodeResult = self.openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = self.apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 c18348ece8c..a20f72804cd 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @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]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, 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) } /** @@ -150,7 +150,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index ad54ab52b72..9f26e85a1f6 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -13,12 +13,12 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -33,13 +33,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,8 +49,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 5e8864e85ea..c65b7cceabf 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -12,12 +12,12 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -31,13 +31,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -47,20 +47,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -74,13 +74,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -90,20 +90,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -117,13 +117,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -133,20 +133,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -160,13 +160,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -176,20 +176,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -203,13 +203,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -219,21 +219,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -247,17 +247,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -266,21 +266,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -295,13 +295,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -311,9 +311,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -333,12 +333,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return 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, openAPIClient: openAPIClient).execute { result 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: URL? = nil, date: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return 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 { result in switch result { case .success: completion((), nil) @@ -369,27 +369,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -403,9 +403,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -486,12 +486,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result 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, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -513,15 +513,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,23 +529,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -557,12 +557,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -582,44 +582,44 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -633,13 +633,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -649,9 +649,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -659,12 +659,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -679,15 +679,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -701,8 +701,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 5d1433ef632..ea006b9ea66 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -13,12 +13,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -36,13 +36,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,8 +52,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index ffa55fa3bcf..381dba4b9a8 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -13,12 +13,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -38,13 +38,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,9 +54,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -64,12 +64,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute { result in + open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -87,28 +87,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -124,12 +124,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -147,17 +147,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -166,22 +166,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -199,18 +199,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -219,21 +219,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { - return getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { + return getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -251,15 +251,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -270,21 +270,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -301,13 +301,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -317,9 +317,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -328,12 +328,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -352,18 +352,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -377,9 +377,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -388,12 +388,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -412,18 +412,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -437,9 +437,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -448,12 +448,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -472,18 +472,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -497,8 +497,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 69d16b42e3c..978d4ab3532 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -13,12 +13,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -33,15 +33,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,20 +52,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { - return getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { + return getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -82,12 +82,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -98,21 +98,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -127,15 +127,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -146,21 +146,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -174,13 +174,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -190,8 +190,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 5383d60d29b..b7688269a31 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -13,12 +13,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -33,13 +33,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,21 +49,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -77,13 +77,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -93,21 +93,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -121,13 +121,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -137,21 +137,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -166,15 +166,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -185,21 +185,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { - return getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { + return getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -213,15 +213,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -232,9 +232,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -242,12 +242,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -263,18 +263,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -283,20 +283,20 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -309,12 +309,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -325,9 +325,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -335,12 +335,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -356,16 +356,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -375,8 +375,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 a5313388c63..7a3c5d2d375 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -10,7 +10,7 @@ import FoundationNetworking #endif import Alamofire -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -58,7 +58,7 @@ open class OpenAPIClient: @unchecked Sendable { self.stringResponseSerializer = stringResponseSerializer } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -69,20 +69,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -105,7 +105,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 62d14a759c0..b9ec99239b6 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -28,8 +28,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { } open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -40,7 +40,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders = buildHeaders() return Alamofire.Session(configuration: configuration, - interceptor: openAPIClient.interceptor) + interceptor: apiConfiguration.interceptor) } /** @@ -172,12 +172,12 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -266,12 +266,12 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is String.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.stringResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.stringResponseSerializer, completionHandler: { stringResponse in cleanupRequest() @@ -284,8 +284,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) case is URL.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -332,8 +332,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild return }) case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -346,8 +346,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) case is Data.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -360,8 +360,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) default: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -384,7 +384,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild return } - let decodeResult = self.openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = self.apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift index c7b6b52fd28..1c3b285fb15 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. - OpenAPIClient.shared.interceptor = BearerTokenHandler() + PetstoreClientAPIConfiguration.shared.interceptor = BearerTokenHandler() return true } diff --git a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift index 15f374a715d..3b503872b06 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift @@ -40,7 +40,7 @@ class BearerTokenHandler: RequestInterceptor, @unchecked Sendable { let dummyBearerToken = "..." bearerToken = dummyBearerToken - OpenAPIClient.shared.customHeaders["Authorization"] = "Bearer \(dummyBearerToken)" + PetstoreClientAPIConfiguration.shared.customHeaders["Authorization"] = "Bearer \(dummyBearerToken)" completionHandler(true) } diff --git a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index c7726214482..525a6f1c885 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + var encodedDate = utcDate.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate1.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,14 +71,14 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate2.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } func testCodableAlwaysResultsInUTCEncodedDate() throws { - OpenAPIClient.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) + PetstoreClientAPIConfiguration.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) let jsonData = "{\"date\":\"1970-01-01T00:00:00.000Z\"}".data(using: .utf8)! - let decodeResult = OpenAPIClient.shared.codableHelper.decode(DateTest.self, from: jsonData) + let decodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.decode(DateTest.self, from: jsonData) _ = try decodeResult.get() var dateComponents = DateComponents() @@ -100,7 +100,7 @@ class DateFormatTests: XCTestCase { } let dateTest = DateTest(date: date) - let encodeResult = OpenAPIClient.shared.codableHelper.encode(dateTest) + let encodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.encode(dateTest) let data = try encodeResult.get() guard let jsonString = String(data: data, encoding: .utf8) else { XCTFail("Unable to convert encoded data to string.") 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 e833a6db629..c995ca9eadb 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -13,9 +13,9 @@ import Combine #endif open class AnotherFakeAPI { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -148,8 +148,8 @@ open class AnotherFakeAPI { */ open func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -159,8 +159,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 26525de39e2..0dbc059ae72 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -13,9 +13,9 @@ import Combine #endif open class FakeAPI { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -141,8 +141,8 @@ open class FakeAPI { */ open func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -152,9 +152,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -280,8 +280,8 @@ open class FakeAPI { */ open func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -291,9 +291,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -419,8 +419,8 @@ open class FakeAPI { */ open func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -430,9 +430,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -558,8 +558,8 @@ open class FakeAPI { */ open func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -569,9 +569,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -697,8 +697,8 @@ open class FakeAPI { */ open func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -708,9 +708,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -842,12 +842,12 @@ open class FakeAPI { */ open func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -856,9 +856,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -991,8 +991,8 @@ open class FakeAPI { */ open func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -1002,9 +1002,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -1231,22 +1231,22 @@ open class FakeAPI { */ open func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1260,9 +1260,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -1511,10 +1511,10 @@ open class FakeAPI { */ open func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1522,23 +1522,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -1706,27 +1706,27 @@ open class FakeAPI { */ open func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -1858,8 +1858,8 @@ open class FakeAPI { */ open func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -1869,9 +1869,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -2010,10 +2010,10 @@ open class FakeAPI { */ open func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -2027,8 +2027,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 371d6b4421c..e68dbde1d6e 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -13,9 +13,9 @@ import Combine #endif open class FakeClassnameTags123API { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -151,8 +151,8 @@ open class FakeClassnameTags123API { */ open func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -162,8 +162,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 c194af440e4..ef08592bd1a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift @@ -13,9 +13,9 @@ import Combine #endif open class PetAPI { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -153,8 +153,8 @@ open class PetAPI { */ open func addPetWithRequestBuilder(body: Pet) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -164,9 +164,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -311,20 +311,20 @@ open class PetAPI { let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -469,12 +469,12 @@ open class PetAPI { */ open func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus]) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -483,9 +483,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -628,12 +628,12 @@ open class PetAPI { @available(*, deprecated, message: "This operation is deprecated.") open func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -642,9 +642,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -783,7 +783,7 @@ open class PetAPI { let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -794,9 +794,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -931,8 +931,8 @@ open class PetAPI { */ open func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -942,9 +942,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -1096,10 +1096,10 @@ open class PetAPI { let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1113,9 +1113,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -1267,10 +1267,10 @@ open class PetAPI { let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1284,9 +1284,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -1438,10 +1438,10 @@ open class PetAPI { let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1455,8 +1455,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 66868cb89f1..ead2ffcadf0 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -13,9 +13,9 @@ import Combine #endif open class StoreAPI { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -151,7 +151,7 @@ open class StoreAPI { let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -162,9 +162,9 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -293,7 +293,7 @@ open class StoreAPI { */ open func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -304,9 +304,9 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -442,7 +442,7 @@ open class StoreAPI { let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -453,9 +453,9 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -587,8 +587,8 @@ open class StoreAPI { */ open func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -598,8 +598,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 4bb1fbdb516..e9b58fdb678 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift @@ -13,9 +13,9 @@ import Combine #endif open class UserAPI { - public let openAPIClient: OpenAPIClient - public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - self.openAPIClient = openAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration + public init(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + self.apiConfiguration = apiConfiguration } /** @@ -148,8 +148,8 @@ open class UserAPI { */ open func createUserWithRequestBuilder(body: User) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -159,9 +159,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -293,8 +293,8 @@ open class UserAPI { */ open func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -304,9 +304,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -438,8 +438,8 @@ open class UserAPI { */ open func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -449,9 +449,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -587,7 +587,7 @@ open class UserAPI { let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -598,9 +598,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -735,7 +735,7 @@ open class UserAPI { let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -746,9 +746,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -888,13 +888,13 @@ open class UserAPI { */ open func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -903,9 +903,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -1030,7 +1030,7 @@ open class UserAPI { */ open func logoutUserWithRequestBuilder() -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -1041,9 +1041,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -1186,8 +1186,8 @@ open class UserAPI { let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -1197,8 +1197,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 2beb10b49b3..8e9136fba19 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -10,7 +10,7 @@ import FoundationNetworking #endif import Alamofire -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -58,7 +58,7 @@ open class OpenAPIClient: @unchecked Sendable { self.stringResponseSerializer = stringResponseSerializer } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -69,20 +69,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -140,7 +140,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 62d14a759c0..b9ec99239b6 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -28,8 +28,8 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { } open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -40,7 +40,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders = buildHeaders() return Alamofire.Session(configuration: configuration, - interceptor: openAPIClient.interceptor) + interceptor: apiConfiguration.interceptor) } /** @@ -172,12 +172,12 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -266,12 +266,12 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil } - let validatedRequest = request.validate(statusCode: openAPIClient.successfulStatusCodeRange) + let validatedRequest = request.validate(statusCode: apiConfiguration.successfulStatusCodeRange) switch T.self { case is String.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.stringResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.stringResponseSerializer, completionHandler: { stringResponse in cleanupRequest() @@ -284,8 +284,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) case is URL.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -332,8 +332,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild return }) case is Void.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { voidResponse in cleanupRequest() @@ -346,8 +346,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) case is Data.Type: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -360,8 +360,8 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild }) default: - validatedRequest.response(queue: openAPIClient.apiResponseQueue, - responseSerializer: openAPIClient.dataResponseSerializer, + validatedRequest.response(queue: apiConfiguration.apiResponseQueue, + responseSerializer: apiConfiguration.dataResponseSerializer, completionHandler: { dataResponse in cleanupRequest() @@ -384,7 +384,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuild return } - let decodeResult = self.openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = self.apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 eadb875907e..0bbc2634349 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,5 +1,5 @@ { - "originHash" : "b14c4fe6a7263c50050b60f25c3f28d6b22d415d0c780c4d5a3494c6c0218ccd", + "originHash" : "472bd6166910f63c0cf0e9ff6ab969628489a7027357cae71bd565f99926ca6b", "pins" : [ { "identity" : "alamofire", @@ -24,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ReactiveX/RxSwift", "state" : { - "revision" : "b06a8c8596e4c3e8e7788e08e720e3248563ce6a", - "version" : "6.7.1" + "revision" : "c7c7d2cf50a3211fe2843f76869c698e4e417930", + "version" : "6.8.0" } } ], 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 0862742c75e..26c9c55d0c7 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -13,12 +13,12 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { + return try await call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,13 +26,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -42,8 +42,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 f6d85eaf0b5..be40f28684e 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -12,25 +12,25 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Bool { - return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -40,33 +40,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> OuterComposite { - return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -76,33 +76,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Double { - return try await fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -112,33 +112,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> String { - return try await fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -148,33 +148,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -184,38 +184,38 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -224,21 +224,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { + return try await testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -246,13 +246,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -262,9 +262,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -284,12 +284,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.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, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -313,27 +313,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -347,9 +347,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -430,12 +430,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -450,15 +450,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -466,23 +466,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -494,12 +494,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -512,57 +512,57 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute().body + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute().body } /** test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -572,9 +572,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -582,12 +582,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -595,15 +595,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -617,8 +617,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 1ea172c5e85..60601c0a064 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -13,12 +13,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { + return try await testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -29,13 +29,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -45,8 +45,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 054a24e3abb..8b13da8f044 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -13,12 +13,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -31,13 +31,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -47,9 +47,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -57,12 +57,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -73,28 +73,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -110,12 +110,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> [Pet] { - return try await findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -126,17 +126,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -145,22 +145,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> [Pet] { - return try await findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute().body + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [Pet] { + return try await findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute().body } /** @@ -171,18 +171,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -191,21 +191,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Pet { - return try await getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute().body + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Pet { + return try await getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute().body } /** @@ -216,15 +216,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -235,21 +235,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -259,13 +259,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -275,9 +275,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -286,12 +286,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -303,18 +303,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -328,9 +328,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -339,12 +339,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> ApiResponse { - return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -356,18 +356,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -381,9 +381,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -392,12 +392,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> ApiResponse { - return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -409,18 +409,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -434,8 +434,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 db645dd19a9..2cf262bb26f 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -13,12 +13,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute().body + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,15 +26,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -45,20 +45,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> [String: Int] { - return try await getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute().body + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [String: Int] { + return try await getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } /** @@ -68,12 +68,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -84,21 +84,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Order { - return try await getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute().body + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { + return try await getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } /** @@ -106,15 +106,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -125,34 +125,34 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Order { - return try await placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { + return try await placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -162,8 +162,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 76a300f7840..bfd8fb7e9a5 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -13,12 +13,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,13 +26,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -42,34 +42,34 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -79,34 +79,34 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -116,21 +116,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute().body + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } /** @@ -138,15 +138,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -157,36 +157,36 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> User { - return try await getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute().body + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> User { + return try await getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } /** Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -197,9 +197,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -207,12 +207,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> String { - return try await loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -221,18 +221,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -241,31 +241,31 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute().body + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -276,9 +276,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -286,12 +286,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -300,16 +300,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -319,8 +319,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 780dd6dd1a5..0aa641e0476 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -126,7 +126,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 f603d527d62..58d420545c5 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 @@ -16,13 +16,13 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -49,13 +49,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -65,8 +65,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 47a6884488b..b7de3b3c944 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 @@ -15,13 +15,13 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -47,13 +47,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -63,21 +63,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -103,13 +103,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -119,21 +119,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -159,13 +159,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -175,21 +175,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -215,13 +215,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -231,21 +231,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -271,13 +271,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -287,22 +287,22 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -328,17 +328,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -347,22 +347,22 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -389,13 +389,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -405,9 +405,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -427,13 +427,13 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.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, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -476,27 +476,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -510,9 +510,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -593,13 +593,13 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -633,15 +633,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -649,23 +649,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -677,13 +677,13 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -715,45 +715,45 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient) + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -779,13 +779,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -795,9 +795,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -805,13 +805,13 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -838,15 +838,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -860,8 +860,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 a84e66d9251..29436cf4e89 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 @@ -16,13 +16,13 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -52,13 +52,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -68,8 +68,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 94ddf898e2b..fceca27c8d5 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 @@ -16,13 +16,13 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -54,13 +54,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -70,9 +70,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -80,13 +80,13 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -116,28 +116,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -153,13 +153,13 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[Pet], Error> { - let requestBuilder = findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient) + 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 return Deferred { Future<[Pet], Error> { promise in nonisolated(unsafe) let promise = promise @@ -189,17 +189,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -208,23 +208,23 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[Pet], Error> { - let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient) + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { + let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future<[Pet], Error> { promise in nonisolated(unsafe) let promise = promise @@ -254,18 +254,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -274,22 +274,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient) + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -319,15 +319,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -338,22 +338,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -382,13 +382,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -398,9 +398,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -409,13 +409,13 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -446,18 +446,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -471,9 +471,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -482,13 +482,13 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -519,18 +519,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -544,9 +544,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -555,13 +555,13 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -592,18 +592,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -617,8 +617,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 3ec77a974a2..12ada44a3b6 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 @@ -16,13 +16,13 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient) + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -49,15 +49,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -68,21 +68,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[String: Int], Error> { - let requestBuilder = getInventoryWithRequestBuilder(openAPIClient: openAPIClient) + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[String: Int], Error> { + let requestBuilder = getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future<[String: Int], Error> { promise in nonisolated(unsafe) let promise = promise @@ -111,12 +111,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -127,22 +127,22 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient) + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -169,15 +169,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -188,22 +188,22 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -229,13 +229,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -245,8 +245,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 a60203d7359..bff93149e61 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 @@ -16,13 +16,13 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -49,13 +49,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -65,22 +65,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -106,13 +106,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -122,22 +122,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -163,13 +163,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -179,22 +179,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient) + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -221,15 +221,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -240,22 +240,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient) + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -281,15 +281,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -300,9 +300,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -310,13 +310,13 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -344,18 +344,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -364,21 +364,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = logoutUserWithRequestBuilder(openAPIClient: openAPIClient) + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -403,12 +403,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -419,9 +419,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -429,13 +429,13 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient) + 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 return Deferred { Future { promise in nonisolated(unsafe) let promise = promise @@ -463,16 +463,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -482,8 +482,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 c3acec934bb..6d50744862b 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 8fb1fb06975..923608a78ed 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/AnotherFakeAPI.swift @@ -16,13 +16,13 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -47,13 +47,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -63,8 +63,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 bd77aa2f115..d21dba7ede6 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift @@ -15,13 +15,13 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -45,13 +45,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -61,21 +61,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -99,13 +99,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -115,21 +115,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -153,13 +153,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -169,21 +169,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -207,13 +207,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -223,21 +223,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -261,13 +261,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -277,22 +277,22 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -316,17 +316,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -335,22 +335,22 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -375,13 +375,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -391,9 +391,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -413,13 +413,13 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.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, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -460,27 +460,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -494,9 +494,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -577,13 +577,13 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -615,15 +615,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -631,23 +631,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -659,13 +659,13 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -695,45 +695,45 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient) + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -757,13 +757,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -773,9 +773,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -783,13 +783,13 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -814,15 +814,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -836,8 +836,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 57a1987447b..3c5188c82de 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeClassnameTags123API.swift @@ -16,13 +16,13 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -50,13 +50,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -66,8 +66,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 c86a7ade281..295633d9856 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift @@ -16,13 +16,13 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -52,13 +52,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -68,9 +68,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -78,13 +78,13 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -112,28 +112,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -149,13 +149,13 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[Pet], Error> { - let requestBuilder = findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient) + 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 return Future<[Pet], Error> { promise in nonisolated(unsafe) let promise = promise @@ -183,17 +183,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -202,23 +202,23 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[Pet], Error> { - let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient) + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[Pet], Error> { + let requestBuilder = findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future<[Pet], Error> { promise in nonisolated(unsafe) let promise = promise @@ -246,18 +246,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -266,22 +266,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient) + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -309,15 +309,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -328,22 +328,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -370,13 +370,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -386,9 +386,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -397,13 +397,13 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -432,18 +432,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -457,9 +457,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -468,13 +468,13 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -503,18 +503,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -528,9 +528,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -539,13 +539,13 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -574,18 +574,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -599,8 +599,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 24d20d6cb0a..f5abc5f0de4 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/StoreAPI.swift @@ -16,13 +16,13 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient) + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -47,15 +47,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -66,21 +66,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher<[String: Int], Error> { - let requestBuilder = getInventoryWithRequestBuilder(openAPIClient: openAPIClient) + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher<[String: Int], Error> { + let requestBuilder = getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future<[String: Int], Error> { promise in nonisolated(unsafe) let promise = promise @@ -107,12 +107,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -123,22 +123,22 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient) + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -163,15 +163,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -182,22 +182,22 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -221,13 +221,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -237,8 +237,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 69561044a07..070313c7bed 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift @@ -16,13 +16,13 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -47,13 +47,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -63,22 +63,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -102,13 +102,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -118,22 +118,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient) + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -157,13 +157,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -173,22 +173,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient) + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -213,15 +213,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -232,22 +232,22 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient) + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -271,15 +271,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -290,9 +290,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -300,13 +300,13 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -332,18 +332,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -352,21 +352,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = logoutUserWithRequestBuilder(openAPIClient: openAPIClient) + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration) let requestTask = requestBuilder.requestTask return Future { promise in nonisolated(unsafe) let promise = promise @@ -389,12 +389,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -405,9 +405,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -415,13 +415,13 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> AnyPublisher { - let requestBuilder = updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient) + 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 return Future { promise in nonisolated(unsafe) let promise = promise @@ -447,16 +447,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -466,8 +466,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 c3acec934bb..6d50744862b 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 55f01a97cf3..f5009bd4ad3 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -14,12 +14,12 @@ open class AnotherFakeAPI { - parameter uuidTest: (header) to test uuid example value - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await call123testSpecialTagsWithRequestBuilder(uuidTest: uuidTest, body: body, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -28,25 +28,25 @@ open class AnotherFakeAPI { - To test special tags and operation ID starting with number - parameter uuidTest: (header) to test uuid example value - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(uuidTest: UUID, body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(uuidTest: UUID, body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/json", - "uuid_test": uuidTest.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "uuid_test": uuidTest.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 6bb85e2d91f..49152f7b88e 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -13,12 +13,12 @@ open class FakeAPI { creates an XmlItem - parameter xmlItem: (body) XmlItem Body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createXmlItemWithRequestBuilder(xmlItem: xmlItem, openAPIClient: openAPIClient).execute().body + open class func createXmlItem(xmlItem: XmlItem, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createXmlItemWithRequestBuilder(xmlItem: xmlItem, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,13 +26,13 @@ open class FakeAPI { - POST /fake/create_xml_item - this route creates an XmlItem - parameter xmlItem: (body) XmlItem Body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createXmlItemWithRequestBuilder(xmlItem: XmlItem, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createXmlItemWithRequestBuilder(xmlItem: XmlItem, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/create_xml_item" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: xmlItem, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: xmlItem, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -42,33 +42,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Bool { - return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -78,33 +78,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> OuterComposite { - return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -114,33 +114,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Double { - return try await fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -150,33 +150,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> String { - return try await fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -186,33 +186,33 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -222,38 +222,38 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute().body + 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 } /** - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -262,21 +262,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { + return try await testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -284,13 +284,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -300,9 +300,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -322,12 +322,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.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, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -351,27 +351,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -385,9 +385,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -468,12 +468,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -488,15 +488,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -504,23 +504,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -532,12 +532,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -550,57 +550,57 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute().body + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute().body } /** test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -610,9 +610,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -620,12 +620,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -633,15 +633,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -655,9 +655,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -667,12 +667,12 @@ open class FakeAPI { - parameter http: (query) - parameter url: (query) - parameter context: (query) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await testQueryParameterCollectionFormatWithRequestBuilder(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -683,21 +683,21 @@ open class FakeAPI { - parameter http: (query) - parameter url: (query) - parameter context: (query) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testQueryParameterCollectionFormatWithRequestBuilder(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testQueryParameterCollectionFormatWithRequestBuilder(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/test-query-parameters" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "pipe": (wrappedValue: pipe.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "ioutil": (wrappedValue: ioutil.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "http": (wrappedValue: http.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "url": (wrappedValue: url.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "context": (wrappedValue: context.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: true), + "pipe": (wrappedValue: pipe.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "ioutil": (wrappedValue: ioutil.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "http": (wrappedValue: http.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "url": (wrappedValue: url.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "context": (wrappedValue: context.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: true), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -706,8 +706,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 1ea172c5e85..60601c0a064 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -13,12 +13,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Client { - return try await testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Client { + return try await testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -29,13 +29,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -45,8 +45,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 eca9439777b..05c6a3f14df 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift @@ -13,12 +13,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -28,13 +28,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -44,9 +44,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -54,12 +54,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -70,28 +70,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -107,12 +107,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> [Pet] { - return try await findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -123,17 +123,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -142,22 +142,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Set { - return try await findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute().body + open class func findPetsByTags(tags: Set, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Set { + return try await findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute().body } /** @@ -168,18 +168,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: Set, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder> { + open class func findPetsByTagsWithRequestBuilder(tags: Set, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -188,21 +188,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Pet { - return try await getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute().body + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Pet { + return try await getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute().body } /** @@ -213,15 +213,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -232,21 +232,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -256,13 +256,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -272,9 +272,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -283,12 +283,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -300,18 +300,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -325,9 +325,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -336,12 +336,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> ApiResponse { - return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -353,18 +353,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -378,9 +378,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -389,12 +389,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> ApiResponse { - return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -406,18 +406,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -431,8 +431,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } 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 db645dd19a9..2cf262bb26f 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -13,12 +13,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute().body + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,15 +26,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -45,20 +45,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> [String: Int] { - return try await getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute().body + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> [String: Int] { + return try await getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } /** @@ -68,12 +68,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -84,21 +84,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Order { - return try await getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute().body + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { + return try await getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute().body } /** @@ -106,15 +106,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -125,34 +125,34 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Order { - return try await placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Order { + return try await placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -162,8 +162,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 76a300f7840..bfd8fb7e9a5 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift @@ -13,12 +13,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** @@ -26,13 +26,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -42,34 +42,34 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -79,34 +79,34 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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], openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute().body + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute().body } /** Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -116,21 +116,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute().body + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } /** @@ -138,15 +138,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -157,36 +157,36 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> User { - return try await getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute().body + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> User { + return try await getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute().body } /** Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -197,9 +197,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -207,12 +207,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> String { - return try await loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -221,18 +221,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -241,31 +241,31 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute().body + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) { + return try await logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -276,9 +276,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -286,12 +286,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) { - return try await updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute().body + 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 } /** @@ -300,16 +300,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -319,8 +319,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 780dd6dd1a5..0aa641e0476 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -126,7 +126,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index 45bcfcaa858..8d162878dd9 100644 --- a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + var encodedDate = utcDate.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate1.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,14 +71,14 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate2.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } func testCodableAlwaysResultsInUTCEncodedDate() throws { - OpenAPIClient.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) + PetstoreClientAPIConfiguration.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) let jsonData = "{\"date\":\"1970-01-01T00:00:00.000Z\"}".data(using: .utf8)! - let decodeResult = OpenAPIClient.shared.codableHelper.decode(DateTest.self, from: jsonData) + let decodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.decode(DateTest.self, from: jsonData) _ = try decodeResult.get() var dateComponents = DateComponents() @@ -100,7 +100,7 @@ class DateFormatTests: XCTestCase { } let dateTest = DateTest(date: date) - let encodeResult = OpenAPIClient.shared.codableHelper.encode(dateTest) + let encodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.encode(dateTest) let data = try encodeResult.get() guard let jsonString = String(data: data, encoding: .utf8) else { XCTFail("Unable to convert encoded data to string.") diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 33441729bb6..fdfcfa243f2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -13,12 +13,12 @@ import Foundation To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -33,13 +33,13 @@ import Foundation - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,8 +49,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift index 76c1d55c50c..74a6a8c69d2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -12,12 +12,12 @@ import Foundation /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -31,13 +31,13 @@ import Foundation - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -47,20 +47,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -74,13 +74,13 @@ import Foundation - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -90,20 +90,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -117,13 +117,13 @@ import Foundation - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -133,20 +133,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -160,13 +160,13 @@ import Foundation - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -176,20 +176,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -203,13 +203,13 @@ import Foundation - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -219,21 +219,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -247,17 +247,17 @@ import Foundation - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -266,21 +266,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -295,13 +295,13 @@ import Foundation - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -311,9 +311,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -333,12 +333,12 @@ import Foundation - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return 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, openAPIClient: openAPIClient).execute { result 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: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return 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 { result in switch result { case .success: completion((), nil) @@ -369,27 +369,27 @@ import Foundation - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -403,9 +403,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -486,12 +486,12 @@ import Foundation - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result 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, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -513,15 +513,15 @@ import Foundation - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,23 +529,23 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -557,12 +557,12 @@ import Foundation - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -582,44 +582,44 @@ import Foundation - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -633,13 +633,13 @@ import Foundation test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -649,9 +649,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -659,12 +659,12 @@ import Foundation - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -679,15 +679,15 @@ import Foundation - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -701,8 +701,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 951a009fee0..d40d52a2215 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -13,12 +13,12 @@ import Foundation To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -36,13 +36,13 @@ import Foundation - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,8 +52,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift index 4229f71788a..4c92f10ded0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift @@ -13,12 +13,12 @@ import Foundation Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -38,13 +38,13 @@ import Foundation - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,9 +54,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -64,12 +64,12 @@ import Foundation - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute { result in + open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -87,28 +87,28 @@ import Foundation - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -124,12 +124,12 @@ import Foundation Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -147,17 +147,17 @@ import Foundation - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -166,22 +166,22 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -199,18 +199,18 @@ import Foundation - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -219,21 +219,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { - return getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { + return getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -251,15 +251,15 @@ import Foundation - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -270,21 +270,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -301,13 +301,13 @@ import Foundation - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -317,9 +317,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -328,12 +328,12 @@ import Foundation - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -352,18 +352,18 @@ import Foundation - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -377,9 +377,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -388,12 +388,12 @@ import Foundation - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -412,18 +412,18 @@ import Foundation - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -437,9 +437,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -448,12 +448,12 @@ import Foundation - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -472,18 +472,18 @@ import Foundation - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -497,8 +497,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/StoreAPI.swift index 36e4143ec30..8442b3f9b48 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -13,12 +13,12 @@ import Foundation Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -33,15 +33,15 @@ import Foundation - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,20 +52,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { - return getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { + return getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -82,12 +82,12 @@ import Foundation - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -98,21 +98,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -127,15 +127,15 @@ import Foundation - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -146,21 +146,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -174,13 +174,13 @@ import Foundation Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -190,8 +190,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift index 3b28786ce94..266a6e6fba4 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift @@ -13,12 +13,12 @@ import Foundation Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -33,13 +33,13 @@ import Foundation - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,21 +49,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -77,13 +77,13 @@ import Foundation Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -93,21 +93,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -121,13 +121,13 @@ import Foundation Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -137,21 +137,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -166,15 +166,15 @@ import Foundation - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -185,21 +185,21 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { - return getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { + return getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -213,15 +213,15 @@ import Foundation Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -232,9 +232,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -242,12 +242,12 @@ import Foundation - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -263,18 +263,18 @@ import Foundation - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -283,20 +283,20 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -309,12 +309,12 @@ import Foundation /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -325,9 +325,9 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -335,12 +335,12 @@ import Foundation - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -356,16 +356,16 @@ import Foundation - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -375,8 +375,8 @@ import Foundation let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 c3acec934bb..6d50744862b 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift index 2c88f461f9d..f54ce791f8d 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift @@ -11,12 +11,12 @@ open class DefaultAPI { /** - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func rootGet(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Fruit?, _ error: Error?) -> Void) -> RequestTask { - return rootGetWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func rootGet(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Fruit?, _ error: Error?) -> Void) -> RequestTask { + return rootGetWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -28,12 +28,12 @@ open class DefaultAPI { /** - GET / - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func rootGetWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func rootGetWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -44,8 +44,8 @@ open class DefaultAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 4cdb41e1204..b90f3e44644 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 8540fe07846..b8871945b90 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -14,12 +14,12 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -35,13 +35,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -51,8 +51,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 0d4dc2f7f6b..59c692cfff3 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -13,12 +13,12 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -33,13 +33,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,20 +49,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -77,13 +77,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -93,20 +93,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -121,13 +121,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -137,20 +137,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -165,13 +165,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -181,20 +181,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -209,13 +209,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -225,21 +225,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -254,17 +254,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -273,21 +273,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -303,13 +303,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -319,9 +319,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -341,12 +341,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + 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) -> Promise { let deferred = Promise.pending() - 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, openAPIClient: openAPIClient).execute { result in + 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 { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -378,27 +378,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -412,9 +412,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -495,12 +495,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + 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) -> Promise { let deferred = Promise.pending() - testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result in + testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -523,15 +523,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -539,23 +539,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -567,12 +567,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -593,44 +593,44 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -645,13 +645,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -661,9 +661,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -671,12 +671,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -692,15 +692,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -714,8 +714,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 9baae6e1b77..191d0d8e714 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -14,12 +14,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -38,13 +38,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,8 +54,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 56af1eb1ae1..70a70536c34 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -14,12 +14,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -40,13 +40,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -56,9 +56,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -66,12 +66,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func deletePet(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute { result in + deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -90,28 +90,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -127,12 +127,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise<[Pet]> */ - open class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise<[Pet]> { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise<[Pet]> { let deferred = Promise<[Pet]>.pending() - findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -151,17 +151,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -170,22 +170,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise<[Pet]> { + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise<[Pet]> { let deferred = Promise<[Pet]>.pending() - findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -204,18 +204,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -224,21 +224,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -257,15 +257,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -276,21 +276,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -308,13 +308,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -324,9 +324,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -335,12 +335,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -360,18 +360,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -385,9 +385,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -396,12 +396,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -421,18 +421,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -446,9 +446,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -457,12 +457,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in + uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -482,18 +482,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -507,8 +507,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 4bef5e3e8a3..b63faef30a6 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -14,12 +14,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -35,15 +35,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,20 +54,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise<[String: Int]> */ - open class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise<[String: Int]> { + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise<[String: Int]> { let deferred = Promise<[String: Int]>.pending() - getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -85,12 +85,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -101,21 +101,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -131,15 +131,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -150,21 +150,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -179,13 +179,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -195,8 +195,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 6c7d90aa3a0..b7a818894c8 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -14,12 +14,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -35,13 +35,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -51,21 +51,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -80,13 +80,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -96,21 +96,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -125,13 +125,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -141,21 +141,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -171,15 +171,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -190,21 +190,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -219,15 +219,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -238,9 +238,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -248,12 +248,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): deferred.resolver.fulfill(response.body) @@ -270,18 +270,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -290,20 +290,20 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -317,12 +317,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -333,9 +333,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -343,12 +343,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Promise */ - open class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Promise { + open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { let deferred = Promise.pending() - updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: deferred.resolver.fulfill(()) @@ -365,16 +365,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -384,8 +384,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 c3acec934bb..6d50744862b 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index c16cca10dc7..6dc3758016a 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -13,12 +13,12 @@ internal class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -33,13 +33,13 @@ internal class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,8 +49,8 @@ internal class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 101c812e73e..d0064620da3 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -12,12 +12,12 @@ internal class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -31,13 +31,13 @@ internal class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -47,20 +47,20 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -74,13 +74,13 @@ internal class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -90,20 +90,20 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -117,13 +117,13 @@ internal class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -133,20 +133,20 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -160,13 +160,13 @@ internal class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -176,20 +176,20 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -203,13 +203,13 @@ internal class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -219,21 +219,21 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + internal class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -247,17 +247,17 @@ internal class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -266,21 +266,21 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -295,13 +295,13 @@ internal class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -311,9 +311,9 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -333,12 +333,12 @@ internal class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testEndpointParametersWithRequestBuilder(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, openAPIClient: openAPIClient).execute { result in + internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testEndpointParametersWithRequestBuilder(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -369,27 +369,27 @@ internal class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testEndpointParametersWithRequestBuilder(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testEndpointParametersWithRequestBuilder(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -403,9 +403,9 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -486,12 +486,12 @@ internal class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result in + internal 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, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -513,15 +513,15 @@ internal class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,23 +529,23 @@ internal class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -557,12 +557,12 @@ internal class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -582,44 +582,44 @@ internal class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + internal class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -633,13 +633,13 @@ internal class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -649,9 +649,9 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -659,12 +659,12 @@ internal class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + internal class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -679,15 +679,15 @@ internal class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -701,8 +701,8 @@ internal class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 58799c12c0c..97139dcc514 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -13,12 +13,12 @@ internal class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -36,13 +36,13 @@ internal class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,8 +52,8 @@ internal class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index d0049c26822..1475d275a19 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -13,12 +13,12 @@ internal class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -38,13 +38,13 @@ internal class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,9 +54,9 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -64,12 +64,12 @@ internal class PetAPI { - parameter apiKey: (header) (optional) - parameter petId: (path) Pet id to delete - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func deletePet(apiKey: String? = nil, petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return deletePetWithRequestBuilder(apiKey: apiKey, petId: petId, openAPIClient: openAPIClient).execute { result in + internal class func deletePet(apiKey: String? = nil, petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return deletePetWithRequestBuilder(apiKey: apiKey, petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -87,28 +87,28 @@ internal class PetAPI { - name: petstore_auth - parameter apiKey: (header) (optional) - parameter petId: (path) Pet id to delete - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func deletePetWithRequestBuilder(apiKey: String? = nil, petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func deletePetWithRequestBuilder(apiKey: String? = nil, petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -124,12 +124,12 @@ internal class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result<[Pet], ErrorResponse>) -> Void) -> RequestTask { - return findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + internal class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result<[Pet], ErrorResponse>) -> Void) -> RequestTask { + return findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -147,17 +147,17 @@ internal class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - internal class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + internal class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -166,22 +166,22 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - internal class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result<[Pet], ErrorResponse>) -> Void) -> RequestTask { - return findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + internal class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result<[Pet], ErrorResponse>) -> Void) -> RequestTask { + return findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -199,18 +199,18 @@ internal class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - internal class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + internal class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -219,21 +219,21 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + internal class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -251,15 +251,15 @@ internal class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -270,21 +270,21 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -301,13 +301,13 @@ internal class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -317,9 +317,9 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -328,12 +328,12 @@ internal class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -352,18 +352,18 @@ internal class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -377,9 +377,9 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -388,12 +388,12 @@ internal class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -412,18 +412,18 @@ internal class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -437,9 +437,9 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -448,12 +448,12 @@ internal class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter requiredFile: (form) file to upload - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile, openAPIClient: openAPIClient).execute { result in + internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -472,18 +472,18 @@ internal class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter requiredFile: (form) file to upload - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -497,8 +497,8 @@ internal class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 69e4ec57859..147a4620c07 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -13,12 +13,12 @@ internal class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + internal class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -33,15 +33,15 @@ internal class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,20 +52,20 @@ internal class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result<[String: Int], ErrorResponse>) -> Void) -> RequestTask { - return getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + internal class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result<[String: Int], ErrorResponse>) -> Void) -> RequestTask { + return getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -82,12 +82,12 @@ internal class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - internal class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + internal class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -98,21 +98,21 @@ internal class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + internal class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -127,15 +127,15 @@ internal class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -146,21 +146,21 @@ internal class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -174,13 +174,13 @@ internal class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -190,8 +190,8 @@ internal class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 77125960b4f..3dd0982cc86 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -13,12 +13,12 @@ internal class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -33,13 +33,13 @@ internal class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -49,21 +49,21 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -77,13 +77,13 @@ internal class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -93,21 +93,21 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + internal class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -121,13 +121,13 @@ internal class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -137,21 +137,21 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + internal class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -166,15 +166,15 @@ internal class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -185,21 +185,21 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + internal class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -213,15 +213,15 @@ internal class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -232,9 +232,9 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -242,12 +242,12 @@ internal class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + internal class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(.success(response.body)) @@ -263,18 +263,18 @@ internal class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -283,20 +283,20 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + internal class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -309,12 +309,12 @@ internal class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -325,9 +325,9 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -335,12 +335,12 @@ internal class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the result */ @discardableResult - internal class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + internal class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion(.success(())) @@ -356,16 +356,16 @@ internal class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - internal class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + internal class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -375,8 +375,8 @@ internal class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 7d8c0e7aaea..58919a74bec 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -internal class OpenAPIClient: @unchecked Sendable { +internal class PetstoreClientAPIConfiguration: @unchecked Sendable { internal var basePath: String internal var customHeaders: [String: String] internal var credential: URLCredential? @@ -44,7 +44,7 @@ internal class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - internal static let shared = OpenAPIClient() + internal static let shared = PetstoreClientAPIConfiguration() } internal class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ internal class RequestBuilder: @unchecked Sendable { internal let URLString: String internal let requestTask: RequestTask = RequestTask() internal let requiresAuthentication: Bool - internal let openAPIClient: OpenAPIClient + internal let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. internal var onProgressReady: ((Progress) -> Void)? - required internal init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required internal init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ internal class RequestBuilder: @unchecked Sendable { } internal func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 417854307c5..cf58e2a66ed 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required internal init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required internal init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab internal func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ internal class URLSessionDecodableRequestBuilder: URLSessionReques return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/rxswiftLibrary/Package.resolved b/samples/client/petstore/swift6/rxswiftLibrary/Package.resolved index 8b2edf6ef04..19905c47f96 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/Package.resolved +++ b/samples/client/petstore/swift6/rxswiftLibrary/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "8715c17031940f4af806198304bcbe69dada24a78bffcac182d214ef9568103b", + "originHash" : "b5331f86bb5f6734f6a85126490aeef164ce9476b31d60ce0dc479f5e104fe35", "pins" : [ { "identity" : "rxswift", "kind" : "remoteSourceControl", "location" : "https://github.com/ReactiveX/RxSwift", "state" : { - "revision" : "b06a8c8596e4c3e8e7788e08e720e3248563ce6a", - "version" : "6.7.1" + "revision" : "c7c7d2cf50a3211fe2843f76869c698e4e417930", + "version" : "6.8.0" } } ], diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index c5d2e1f0e08..10a22eb807c 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -14,12 +14,12 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -40,13 +40,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -56,8 +56,8 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 60e8e223ad0..4765274bd2a 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -13,12 +13,12 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -38,13 +38,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -54,20 +54,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -87,13 +87,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -103,20 +103,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -136,13 +136,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -152,20 +152,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -185,13 +185,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -201,20 +201,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -234,13 +234,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -250,21 +250,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -284,17 +284,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -303,21 +303,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -338,13 +338,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -354,9 +354,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -376,12 +376,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + 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) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.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, openAPIClient: openAPIClient).execute { result in + let requestTask = self.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 { result in switch result { case .success: observer.onNext(()) @@ -418,27 +418,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -452,9 +452,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -535,12 +535,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + 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) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -568,15 +568,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -584,23 +584,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -612,12 +612,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -643,44 +643,44 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -700,13 +700,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -716,9 +716,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -726,12 +726,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -752,15 +752,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -774,8 +774,8 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 38a9ee53a10..4ddb2888e17 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -14,12 +14,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -43,13 +43,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -59,8 +59,8 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 9212294bd2b..7b00cef5f45 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -14,12 +14,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -45,13 +45,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -61,9 +61,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -71,12 +71,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func deletePet(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute { result in + let requestTask = self.deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -100,28 +100,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -137,12 +137,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable<[Pet]> */ - open class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable<[Pet]> { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable<[Pet]> { return Observable.create { observer -> Disposable in - let requestTask = self.findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + let requestTask = self.findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -166,17 +166,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -185,22 +185,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable<[Pet]> { + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable<[Pet]> { return Observable.create { observer -> Disposable in - let requestTask = self.findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + let requestTask = self.findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -224,18 +224,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -244,21 +244,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + let requestTask = self.getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -282,15 +282,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -301,21 +301,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -338,13 +338,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -354,9 +354,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -365,12 +365,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + let requestTask = self.updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -395,18 +395,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -420,9 +420,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -431,12 +431,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + let requestTask = self.uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -461,18 +461,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -486,9 +486,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -497,12 +497,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in + let requestTask = self.uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -527,18 +527,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -552,8 +552,8 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 0b600996ca6..eb522d64ecc 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -14,12 +14,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + let requestTask = self.deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -40,15 +40,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -59,20 +59,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable<[String: Int]> */ - open class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable<[String: Int]> { + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable<[String: Int]> { return Observable.create { observer -> Disposable in - let requestTask = self.getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + let requestTask = self.getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -95,12 +95,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -111,21 +111,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + let requestTask = self.getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -146,15 +146,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -165,21 +165,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -199,13 +199,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -215,8 +215,8 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index c4f38351a52..8b9ef268206 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -14,12 +14,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -40,13 +40,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -56,21 +56,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -90,13 +90,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -106,21 +106,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -140,13 +140,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -156,21 +156,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + let requestTask = self.deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -191,15 +191,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -210,21 +210,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + let requestTask = self.getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -244,15 +244,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -263,9 +263,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -273,12 +273,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + let requestTask = self.loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): observer.onNext(response.body) @@ -300,18 +300,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -320,20 +320,20 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + let requestTask = self.logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -352,12 +352,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -368,9 +368,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -378,12 +378,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: Observable */ - open class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> Observable { + open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { return Observable.create { observer -> Disposable in - let requestTask = self.updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + let requestTask = self.updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: observer.onNext(()) @@ -405,16 +405,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -424,8 +424,8 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 c3acec934bb..6d50744862b 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -91,7 +91,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8b2edf6ef04..19905c47f96 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift6/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "8715c17031940f4af806198304bcbe69dada24a78bffcac182d214ef9568103b", + "originHash" : "b5331f86bb5f6734f6a85126490aeef164ce9476b31d60ce0dc479f5e104fe35", "pins" : [ { "identity" : "rxswift", "kind" : "remoteSourceControl", "location" : "https://github.com/ReactiveX/RxSwift", "state" : { - "revision" : "b06a8c8596e4c3e8e7788e08e720e3248563ce6a", - "version" : "6.7.1" + "revision" : "c7c7d2cf50a3211fe2843f76869c698e4e417930", + "version" : "6.8.0" } } ], diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 9837742a23b..4b57ceff573 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -16,12 +16,12 @@ open class AnotherFakeAPI { To test special tags - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return call123testSpecialTagsWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func call123testSpecialTags(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return call123testSpecialTagsWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -36,13 +36,13 @@ open class AnotherFakeAPI { - PATCH /another-fake/dummy - To test special tags and operation ID starting with number - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func call123testSpecialTagsWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,9 +52,9 @@ open class AnotherFakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index f580b54f406..f71732627a5 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -15,12 +15,12 @@ open class FakeAPI { /** - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterBooleanSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Bool?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterBooleanSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -34,13 +34,13 @@ open class FakeAPI { - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -50,20 +50,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterCompositeSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterCompositeSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -77,13 +77,13 @@ open class FakeAPI { - POST /fake/outer/composite - Test serialization of object with outer number type - parameter body: (body) Input composite as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -93,20 +93,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterNumberSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterNumberSerialize(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Double?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterNumberSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -120,13 +120,13 @@ open class FakeAPI { - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -136,20 +136,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return fakeOuterStringSerializeWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func fakeOuterStringSerialize(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return fakeOuterStringSerializeWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -163,13 +163,13 @@ open class FakeAPI { - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -179,20 +179,20 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithFileSchemaWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithFileSchemaWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -206,13 +206,13 @@ open class FakeAPI { - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -222,21 +222,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, openAPIClient: openAPIClient).execute { result in + open class func testBodyWithQueryParams(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -250,17 +250,17 @@ open class FakeAPI { - PUT /fake/body-with-query-params - parameter query: (query) - parameter body: (body) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -269,21 +269,21 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClientModelWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClientModel(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClientModelWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -298,13 +298,13 @@ open class FakeAPI { - PATCH /fake - To test \"client\" model - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClientModelWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -314,9 +314,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -336,12 +336,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return 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, openAPIClient: openAPIClient).execute { result 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, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return 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 { result in switch result { case .success: completion((), nil) @@ -372,27 +372,27 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(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, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "integer": integer?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int32": int32?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "int64": int64?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "number": number.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "float": float?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "double": double.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "string": string?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "byte": byte.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "binary": binary?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "date": date?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "dateTime": dateTime?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "password": password?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "callback": callback?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -406,9 +406,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -489,12 +489,12 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, openAPIClient: openAPIClient).execute { result 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, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -516,15 +516,15 @@ open class FakeAPI { - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_form_string": enumFormString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -532,23 +532,23 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -560,12 +560,12 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, openAPIClient: openAPIClient).execute { result in + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -585,44 +585,44 @@ open class FakeAPI { - parameter stringGroup: (query) String in group parameters (optional) - parameter booleanGroup: (header) Boolean in group parameters (optional) - parameter int64Group: (query) Integer in group parameters (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "boolean_group": booleanGroup?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** test inline additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testInlineAdditionalPropertiesWithRequestBuilder(param: param, openAPIClient: openAPIClient).execute { result in + open class func testInlineAdditionalProperties(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testInlineAdditionalPropertiesWithRequestBuilder(param: param, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -636,13 +636,13 @@ open class FakeAPI { test inline additionalProperties - POST /fake/inline-additionalProperties - parameter param: (body) request body - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -652,9 +652,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -662,12 +662,12 @@ open class FakeAPI { - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return testJsonFormDataWithRequestBuilder(param: param, param2: param2, openAPIClient: openAPIClient).execute { result in + open class func testJsonFormData(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return testJsonFormDataWithRequestBuilder(param: param, param2: param2, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -682,15 +682,15 @@ open class FakeAPI { - GET /fake/jsonFormData - parameter param: (form) field1 - parameter param2: (form) field2 - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "param": param.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "param2": param2.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -704,9 +704,9 @@ open class FakeAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 02d9328685a..f4d4fe89c8c 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -16,12 +16,12 @@ open class FakeClassnameTags123API { To test class name in snake case - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { - return testClassnameWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func testClassname(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Client?, _ error: Error?) -> Void) -> RequestTask { + return testClassnameWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -39,13 +39,13 @@ open class FakeClassnameTags123API { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) client model - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func testClassnameWithRequestBuilder(body: Client, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -55,9 +55,9 @@ open class FakeClassnameTags123API { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 977022cc096..e4cf4b619d0 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -16,12 +16,12 @@ open class PetAPI { Add a new pet to the store - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return addPetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func addPet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return addPetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -41,13 +41,13 @@ open class PetAPI { - type: apiKey api_key_query (QUERY) - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func addPetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -57,9 +57,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -67,12 +67,12 @@ open class PetAPI { - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, openAPIClient: openAPIClient).execute { result in + open class func deletePet(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -90,28 +90,28 @@ open class PetAPI { - name: petstore_auth - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: Any?] = [ - "api_key": apiKey?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -127,12 +127,12 @@ open class PetAPI { Finds Pets by status - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByStatusWithRequestBuilder(status: status, openAPIClient: openAPIClient).execute { result in + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByStatusWithRequestBuilder(status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -150,17 +150,17 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter status: (query) Status values that need to be considered for filter - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ - open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -169,22 +169,22 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Finds Pets by tags - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { - return findPetsByTagsWithRequestBuilder(tags: tags, openAPIClient: openAPIClient).execute { result in + open class func findPetsByTags(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [Pet]?, _ error: Error?) -> Void) -> RequestTask { + return findPetsByTagsWithRequestBuilder(tags: tags, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -202,18 +202,18 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter tags: (query) Tags to filter by - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[Pet]> */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsWithRequestBuilder(tags: [String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[Pet]> { + open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -222,21 +222,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find pet by ID - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { - return getPetByIdWithRequestBuilder(petId: petId, openAPIClient: openAPIClient).execute { result in + open class func getPetById(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Pet?, _ error: Error?) -> Void) -> RequestTask { + return getPetByIdWithRequestBuilder(petId: petId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -254,15 +254,15 @@ open class PetAPI { - type: apiKey api_key (HEADER) - name: api_key - parameter petId: (path) ID of pet to return - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getPetByIdWithRequestBuilder(petId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getPetByIdWithRequestBuilder(petId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -273,21 +273,21 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Update an existing pet - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func updatePet(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -304,13 +304,13 @@ open class PetAPI { - type: oauth2 - name: petstore_auth - parameter body: (body) Pet object that needs to be added to the store - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithRequestBuilder(body: Pet, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -320,9 +320,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -331,12 +331,12 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, openAPIClient: openAPIClient).execute { result in + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -355,18 +355,18 @@ open class PetAPI { - parameter petId: (path) ID of pet that needs to be updated - parameter name: (form) Updated name of the pet (optional) - parameter status: (form) Updated status of the pet (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "name": name?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "status": status?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -380,9 +380,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -391,12 +391,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -415,18 +415,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter additionalMetadata: (form) Additional data to pass to server (optional) - parameter file: (form) file to upload (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "file": file?.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -440,9 +440,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** @@ -451,12 +451,12 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -475,18 +475,18 @@ open class PetAPI { - parameter petId: (path) ID of pet to update - parameter requiredFile: (form) file to upload - parameter additionalMetadata: (form) Additional data to pass to server (optional) - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: Any?] = [ - "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: openAPIClient.codableHelper), - "requiredFile": requiredFile.encodeToJSON(codableHelper: openAPIClient.codableHelper), + "additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -500,9 +500,9 @@ open class PetAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 84b65132f6f..ace217dd9d4 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -16,12 +16,12 @@ open class StoreAPI { Delete purchase order by ID - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteOrderWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func deleteOrder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteOrderWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -36,15 +36,15 @@ open class StoreAPI { - DELETE /store/order/{order_id} - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteOrderWithRequestBuilder(orderId: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteOrderWithRequestBuilder(orderId: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -55,20 +55,20 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Returns pet inventories by status - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { - return getInventoryWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func getInventory(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: [String: Int]?, _ error: Error?) -> Void) -> RequestTask { + return getInventoryWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -85,12 +85,12 @@ open class StoreAPI { - API Key: - type: apiKey api_key (HEADER) - name: api_key - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder<[String: Int]> */ - open class func getInventoryWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -101,21 +101,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } /** Find purchase order by ID - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return getOrderByIdWithRequestBuilder(orderId: orderId, openAPIClient: openAPIClient).execute { result in + open class func getOrderById(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return getOrderByIdWithRequestBuilder(orderId: orderId, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -130,15 +130,15 @@ open class StoreAPI { - GET /store/order/{order_id} - For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - parameter orderId: (path) ID of pet that needs to be fetched - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getOrderByIdWithRequestBuilder(orderId: Int64, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getOrderByIdWithRequestBuilder(orderId: Int64, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -149,21 +149,21 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Place an order for a pet - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { - return placeOrderWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func placeOrder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Order?, _ error: Error?) -> Void) -> RequestTask { + return placeOrderWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -177,13 +177,13 @@ open class StoreAPI { Place an order for a pet - POST /store/order - parameter body: (body) order placed for purchasing the pet - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func placeOrderWithRequestBuilder(body: Order, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -193,9 +193,9 @@ open class StoreAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index ac5d901c051..5e214fa9db1 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -16,12 +16,12 @@ open class UserAPI { Create user - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUserWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUser(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUserWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -36,13 +36,13 @@ open class UserAPI { - POST /user - This can only be done by the logged in user. - parameter body: (body) Created user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUserWithRequestBuilder(body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -52,21 +52,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithArrayInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithArrayInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithArrayInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -80,13 +80,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithArray - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithArrayInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -96,21 +96,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Creates list of users with given input array - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return createUsersWithListInputWithRequestBuilder(body: body, openAPIClient: openAPIClient).execute { result in + open class func createUsersWithListInput(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return createUsersWithListInputWithRequestBuilder(body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -124,13 +124,13 @@ open class UserAPI { Creates list of users with given input array - POST /user/createWithList - parameter body: (body) List of user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func createUsersWithListInputWithRequestBuilder(body: [User], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -140,21 +140,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Delete user - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return deleteUserWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func deleteUser(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return deleteUserWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -169,15 +169,15 @@ open class UserAPI { - DELETE /user/{username} - This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func deleteUserWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func deleteUserWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -188,21 +188,21 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Get user by user name - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { - return getUserByNameWithRequestBuilder(username: username, openAPIClient: openAPIClient).execute { result in + open class func getUserByName(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: User?, _ error: Error?) -> Void) -> RequestTask { + return getUserByNameWithRequestBuilder(username: username, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -216,15 +216,15 @@ open class UserAPI { Get user by user name - GET /user/{username} - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func getUserByNameWithRequestBuilder(username: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func getUserByNameWithRequestBuilder(username: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -235,9 +235,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -245,12 +245,12 @@ open class UserAPI { - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { - return loginUserWithRequestBuilder(username: username, password: password, openAPIClient: openAPIClient).execute { result in + open class func loginUser(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: String?, _ error: Error?) -> Void) -> RequestTask { + return loginUserWithRequestBuilder(username: username, password: password, apiConfiguration: apiConfiguration).execute { result in switch result { case let .success(response): completion(response.body, nil) @@ -266,18 +266,18 @@ open class UserAPI { - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] - parameter username: (query) The user name for login - parameter password: (query) The password for login in clear text - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func loginUserWithRequestBuilder(username: String, password: String, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToJSON(codableHelper: openAPIClient.codableHelper), isExplode: false), + "username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: Any?] = [ @@ -286,20 +286,20 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** Logs out current logged in user session - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return logoutUserWithRequestBuilder(openAPIClient: openAPIClient).execute { result in + open class func logoutUser(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return logoutUserWithRequestBuilder(apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -312,12 +312,12 @@ open class UserAPI { /** Logs out current logged in user session - GET /user/logout - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func logoutUserWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -328,9 +328,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } /** @@ -338,12 +338,12 @@ open class UserAPI { - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { - return updateUserWithRequestBuilder(username: username, body: body, openAPIClient: openAPIClient).execute { result in + open class func updateUser(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask { + return updateUserWithRequestBuilder(username: username, body: body, apiConfiguration: apiConfiguration).execute { result in switch result { case .success: completion((), nil) @@ -359,16 +359,16 @@ open class UserAPI { - This can only be done by the logged in user. - parameter username: (path) name that need to be deleted - parameter body: (body) Updated user object - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func updateUserWithRequestBuilder(username: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func updateUserWithRequestBuilder(username: String, body: User, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { var localVariablePath = "/user/{username}" let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: apiConfiguration.codableHelper) let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -378,9 +378,9 @@ open class UserAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getNonDecodableBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getNonDecodableBuilder() - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } } 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 86016f1efe9..62aafe3f0d5 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -11,7 +11,7 @@ import FoundationNetworking public enum PetstoreClientAPI {} -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -46,7 +46,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -57,20 +57,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -93,7 +93,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift index 50c5bcf9a8b..45500b43017 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/AppDelegate.swift @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. - OpenAPIClient.shared.interceptor = BearerOpenAPIInterceptor() + PetstoreClientAPIConfiguration.shared.interceptor = BearerOpenAPIInterceptor() return true } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift index c190c251663..f15a53536d3 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerTokenHandler.swift @@ -27,7 +27,7 @@ public class BearerOpenAPIInterceptor: OpenAPIInterceptor { newUrlRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") // Change the global headers - requestBuilder.openAPIClient.customHeaders["Authorization"] = "Bearer \(token)" + requestBuilder.apiConfiguration.customHeaders["Authorization"] = "Bearer \(token)" completion(.success(newUrlRequest)) } @@ -44,7 +44,7 @@ public class BearerOpenAPIInterceptor: OpenAPIInterceptor { if wasTokenRefreshed, let newToken = newToken { // Change the global headers - requestBuilder.openAPIClient.customHeaders["Authorization"] = "Bearer \(newToken)" + requestBuilder.apiConfiguration.customHeaders["Authorization"] = "Bearer \(newToken)" completion(.retry) } else { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index 45bcfcaa858..8d162878dd9 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + var encodedDate = utcDate.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate1.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,14 +71,14 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToJSON(codableHelper: OpenAPIClient.shared.codableHelper) as! String + encodedDate = nonUTCDate2.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } func testCodableAlwaysResultsInUTCEncodedDate() throws { - OpenAPIClient.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) + PetstoreClientAPIConfiguration.shared.codableHelper.jsonEncoder.outputFormatting.remove(.prettyPrinted) let jsonData = "{\"date\":\"1970-01-01T00:00:00.000Z\"}".data(using: .utf8)! - let decodeResult = OpenAPIClient.shared.codableHelper.decode(DateTest.self, from: jsonData) + let decodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.decode(DateTest.self, from: jsonData) _ = try decodeResult.get() var dateComponents = DateComponents() @@ -100,7 +100,7 @@ class DateFormatTests: XCTestCase { } let dateTest = DateTest(date: date) - let encodeResult = OpenAPIClient.shared.codableHelper.encode(dateTest) + let encodeResult = PetstoreClientAPIConfiguration.shared.codableHelper.encode(dateTest) let data = try encodeResult.get() guard let jsonString = String(data: data, encoding: .utf8) else { XCTFail("Unable to convert encoded data to string.") 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 cacf82e53c7..18ada88cecb 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 @@ -11,22 +11,22 @@ open class DefaultAPI { /** - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - 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(openAPIClient: OpenAPIClient = OpenAPIClient.shared) async throws(ErrorResponse) -> Banana { - return try await rootGetWithRequestBuilder(openAPIClient: openAPIClient).execute().body + open class func rootGet(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> Banana { + return try await rootGetWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body } /** - GET / - - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request. + - parameter apiConfiguration: The configuration for the http request. - returns: RequestBuilder */ - open class func rootGetWithRequestBuilder(openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder { + open class func rootGetWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { let localVariablePath = "/" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableParameters: [String: Any]? = nil let localVariableUrlComponents = URLComponents(string: localVariableURLString) @@ -37,8 +37,8 @@ open class DefaultAPI { let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - let localVariableRequestBuilder: RequestBuilder.Type = openAPIClient.requestBuilderFactory.getBuilder() + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, openAPIClient: openAPIClient) + return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration) } } 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 78354f00789..30038c2863a 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 @@ -9,7 +9,7 @@ import Foundation import FoundationNetworking #endif -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: [String: String] public var credential: URLCredential? @@ -44,7 +44,7 @@ open class OpenAPIClient: @unchecked Sendable { self.interceptor = interceptor } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } open class RequestBuilder: @unchecked Sendable { @@ -55,20 +55,20 @@ open class RequestBuilder: @unchecked Sendable { public let URLString: String public let requestTask: RequestTask = RequestTask() public let requiresAuthentication: Bool - public let openAPIClient: OpenAPIClient + public let apiConfiguration: PetstoreClientAPIConfiguration /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { self.method = method self.URLString = URLString self.parameters = parameters self.headers = headers self.requiresAuthentication = requiresAuthentication - self.openAPIClient = openAPIClient + self.apiConfiguration = apiConfiguration - addHeaders(openAPIClient.customHeaders) + addHeaders(apiConfiguration.customHeaders) addCredential() } @@ -126,7 +126,7 @@ open class RequestBuilder: @unchecked Sendable { } open func addCredential() { - credential = openAPIClient.credential + credential = apiConfiguration.credential } } 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 42714671076..043a2d5d8e2 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 @@ -71,8 +71,8 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, openAPIClient: openAPIClient) + required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { + super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } /** @@ -150,7 +150,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - openAPIClient.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in + apiConfiguration.interceptor.intercept(urlRequest: request, urlSession: urlSession, requestBuilder: self) { result in switch result { case .success(let modifiedRequest): @@ -183,7 +183,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { return } - guard self.openAPIClient.successfulStatusCodeRange.contains(httpResponse.statusCode) else { + guard self.apiConfiguration.successfulStatusCodeRange.contains(httpResponse.statusCode) else { self.retryRequest( urlRequest: modifiedRequest, urlSession: urlSession, @@ -208,13 +208,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { dataTask.resume() case .failure(let error): - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } } } catch { - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } } @@ -229,13 +229,13 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } private func retryRequest(urlRequest: URLRequest, urlSession: URLSessionProtocol, statusCode: Int, data: Data?, response: URLResponse?, error: Error, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - self.openAPIClient.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in + self.apiConfiguration.interceptor.retry(urlRequest: urlRequest, urlSession: urlSession, requestBuilder: self, data: data, response: response, error: error) { retry in switch retry { case .retry: self.execute(completion: completion) case .dontRetry: - self.openAPIClient.apiResponseQueue.async { + self.apiConfiguration.apiResponseQueue.async { completion(.failure(ErrorResponse.error(statusCode, data, response, error))) } } @@ -257,7 +257,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in openAPIClient.customHeaders { + for (key, value) in apiConfiguration.customHeaders { httpHeaders[key] = value } for (key, value) in headers { @@ -385,7 +385,7 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui return } - let decodeResult = openAPIClient.codableHelper.decode(T.self, from: unwrappedData) + let decodeResult = apiConfiguration.codableHelper.decode(T.self, from: unwrappedData) switch decodeResult { case let .success(decodableObj): 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 a1cc0367556..490594e67bb 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -18,12 +18,12 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/another-fake/dummy" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -32,7 +32,7 @@ open class AnotherFakeAPI { localVariableRequest.headers.add(name: "uuid_test", value: uuidTest.description) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Client.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -51,11 +51,11 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `Call123testSpecialTags` */ - open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Client.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) default: return .http0(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 c51e0c81576..480dc61d468 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -17,19 +17,19 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/create_xml_item" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(xmlItem, using: openAPIClient.contentConfiguration.requireEncoder(for: XmlItem.defaultContentType)) + try localVariableRequest.content.encode(xmlItem, using: apiConfiguration.contentConfiguration.requireEncoder(for: XmlItem.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -47,7 +47,7 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `CreateXmlItem` */ - open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -64,12 +64,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterBooleanSerializeRaw(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/boolean" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -77,7 +77,7 @@ open class FakeAPI { if let localVariableBody = body { - try localVariableRequest.content.encode(localVariableBody, using: openAPIClient.contentConfiguration.requireEncoder(for: Bool.defaultContentType)) + try localVariableRequest.content.encode(localVariableBody, using: apiConfiguration.contentConfiguration.requireEncoder(for: Bool.defaultContentType)) } try beforeSend(&localVariableRequest) @@ -95,11 +95,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Bool.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Bool.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Bool.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Bool.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -112,12 +112,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterCompositeSerializeRaw(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/composite" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -125,7 +125,7 @@ open class FakeAPI { if let localVariableBody = body { - try localVariableRequest.content.encode(localVariableBody, using: openAPIClient.contentConfiguration.requireEncoder(for: OuterComposite.defaultContentType)) + try localVariableRequest.content.encode(localVariableBody, using: apiConfiguration.contentConfiguration.requireEncoder(for: OuterComposite.defaultContentType)) } try beforeSend(&localVariableRequest) @@ -143,11 +143,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(OuterComposite.self, using: openAPIClient.contentConfiguration.requireDecoder(for: OuterComposite.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(OuterComposite.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: OuterComposite.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -160,12 +160,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterNumberSerializeRaw(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/number" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -173,7 +173,7 @@ open class FakeAPI { if let localVariableBody = body { - try localVariableRequest.content.encode(localVariableBody, using: openAPIClient.contentConfiguration.requireEncoder(for: Double.defaultContentType)) + try localVariableRequest.content.encode(localVariableBody, using: apiConfiguration.contentConfiguration.requireEncoder(for: Double.defaultContentType)) } try beforeSend(&localVariableRequest) @@ -191,11 +191,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Double.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Double.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Double.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Double.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -208,12 +208,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterStringSerializeRaw(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/string" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -221,7 +221,7 @@ open class FakeAPI { if let localVariableBody = body { - try localVariableRequest.content.encode(localVariableBody, using: openAPIClient.contentConfiguration.requireEncoder(for: String.defaultContentType)) + try localVariableRequest.content.encode(localVariableBody, using: apiConfiguration.contentConfiguration.requireEncoder(for: String.defaultContentType)) } try beforeSend(&localVariableRequest) @@ -239,11 +239,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(String.self, using: openAPIClient.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -256,19 +256,19 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-file-schema" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: FileSchemaTestClass.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: FileSchemaTestClass.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -285,7 +285,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithFileSchema` */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -302,12 +302,12 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-query-params" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -321,7 +321,7 @@ open class FakeAPI { } } try localVariableRequest.query.encode(QueryParams(query: query)) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: User.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -338,7 +338,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithQueryParams` */ - open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -356,19 +356,19 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClientModelRaw(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClientModelRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Client.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -386,11 +386,11 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClientModel` */ - open class func testClientModel(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Client.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -420,12 +420,12 @@ 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 = OpenAPIClient.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 = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -449,7 +449,7 @@ open class FakeAPI { var password: String? var callback: String? } - try localVariableRequest.content.encode(FormParams(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -483,7 +483,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: @@ -577,12 +577,12 @@ 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 = OpenAPIClient.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 = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -611,7 +611,7 @@ open class FakeAPI { var enumFormStringArray: [EnumFormStringArray_testEnumParameters]? var enumFormString: EnumFormString_testEnumParameters? } - try localVariableRequest.content.encode(FormParams(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -636,7 +636,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: @@ -661,12 +661,12 @@ 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 = OpenAPIClient.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 = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -712,7 +712,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: @@ -729,19 +729,19 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/inline-additionalProperties" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(param, using: openAPIClient.contentConfiguration.requireEncoder(for: [String: String].defaultContentType)) + try localVariableRequest.content.encode(param, using: apiConfiguration.contentConfiguration.requireEncoder(for: [String: String].defaultContentType)) try beforeSend(&localVariableRequest) } @@ -758,7 +758,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `TestInlineAdditionalProperties` */ - open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -776,12 +776,12 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/jsonFormData" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -793,7 +793,7 @@ open class FakeAPI { var param: String var param2: String } - try localVariableRequest.content.encode(FormParams(param: param, param2: param2), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(param: param, param2: param2), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -810,7 +810,7 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `TestJsonFormData` */ - open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -831,12 +831,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 { let localVariablePath = "/fake/test-query-parameters" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -878,7 +878,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: 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 c79ebe4d348..793f6a370ed 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -20,19 +20,19 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClassnameRaw(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClassnameRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake_classname_test" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Client.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -53,11 +53,11 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClassname` */ - open class func testClassname(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Client.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) default: return .http0(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 e93e73fcb53..e3e6be3bf6d 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -19,19 +19,19 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func addPetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -52,7 +52,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -75,15 +75,15 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -113,7 +113,7 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `DeletePet` */ - open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -145,12 +145,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByStatusRaw(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByStatus" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -185,11 +185,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode([Pet].self, using: openAPIClient.contentConfiguration.requireDecoder(for: [Pet].defaultContentType)), raw: response) + return .http200(value: try response.content.decode([Pet].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [Pet].defaultContentType)), raw: response) case 400: return .http400(raw: response) default: @@ -209,12 +209,12 @@ open class PetAPI { - returns: `EventLoopFuture` of `ClientResponse` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByTags" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -250,11 +250,11 @@ open class PetAPI { - returns: `EventLoopFuture` of `FindPetsByTags` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: Set, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Set.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Set.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Set.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Set.defaultContentType)), raw: response) case 400: return .http400(raw: response) default: @@ -273,15 +273,15 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -310,11 +310,11 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `GetPetById` */ - open class func getPetById(petId: Int64, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Pet.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Pet.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Pet.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Pet.defaultContentType)), raw: response) case 400: return .http400(raw: response) case 404: @@ -334,19 +334,19 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -369,7 +369,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: @@ -397,15 +397,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetWithFormRaw(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -417,7 +417,7 @@ open class PetAPI { var name: String? var status: String? } - try localVariableRequest.content.encode(FormParams(name: name, status: status), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(name: name, status: status), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -438,7 +438,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 405: @@ -460,15 +460,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileRaw(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -480,7 +480,7 @@ open class PetAPI { var additionalMetadata: String? var file: Data? } - try localVariableRequest.content.encode(FormParams(additionalMetadata: additionalMetadata, file: file), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(additionalMetadata: additionalMetadata, file: file), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -501,11 +501,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(ApiResponse.self, using: openAPIClient.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -523,15 +523,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileWithRequiredFileRaw(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -543,7 +543,7 @@ open class PetAPI { var additionalMetadata: String? var requiredFile: Data } - try localVariableRequest.content.encode(FormParams(additionalMetadata: additionalMetadata, requiredFile: requiredFile), using: openAPIClient.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) + try localVariableRequest.content.encode(FormParams(additionalMetadata: additionalMetadata, requiredFile: requiredFile), using: apiConfiguration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)) try beforeSend(&localVariableRequest) } } @@ -564,11 +564,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(ApiResponse.self, using: openAPIClient.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) default: return .http0(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 cc6f5925e59..3b66f4fe05c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -17,15 +17,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteOrderRaw(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -50,7 +50,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: @@ -72,12 +72,12 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getInventoryRaw(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getInventoryRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/inventory" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -103,11 +103,11 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `GetInventory` */ - open class func getInventory(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode([String: Int].self, using: openAPIClient.contentConfiguration.requireDecoder(for: [String: Int].defaultContentType)), raw: response) + return .http200(value: try response.content.decode([String: Int].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [String: Int].defaultContentType)), raw: response) default: return .http0(raw: response) } @@ -121,15 +121,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getOrderByIdRaw(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -155,11 +155,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Order.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) case 400: return .http400(raw: response) case 404: @@ -176,19 +176,19 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `ClientResponse` */ - open class func placeOrderRaw(body: Order, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func placeOrderRaw(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/order" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: Order.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Order.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -206,11 +206,11 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `PlaceOrder` */ - open class func placeOrder(body: Order, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(Order.self, using: openAPIClient.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) case 400: return .http400(raw: response) default: 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 29b6e495a57..6038bfc99fc 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -17,19 +17,19 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUserRaw(body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUserRaw(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: User.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -46,7 +46,7 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `CreateUser` */ - open class func createUser(body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { default: @@ -61,19 +61,19 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithArray" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: [User].defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) try beforeSend(&localVariableRequest) } @@ -89,7 +89,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithArrayInput` */ - open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { default: @@ -104,19 +104,19 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithList" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: [User].defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) try beforeSend(&localVariableRequest) } @@ -132,7 +132,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithListInput` */ - open class func createUsersWithListInput(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { default: @@ -148,15 +148,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteUserRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -181,7 +181,7 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: @@ -200,15 +200,15 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getUserByNameRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -233,11 +233,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(User.self, using: openAPIClient.contentConfiguration.requireDecoder(for: User.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(User.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: User.defaultContentType)), raw: response) case 400: return .http400(raw: response) case 404: @@ -256,12 +256,12 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func loginUserRaw(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/login" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -296,11 +296,11 @@ 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 200: - return .http200(value: try response.content.decode(String.self, using: openAPIClient.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) + return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) case 400: return .http400(raw: response) default: @@ -314,12 +314,12 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `ClientResponse` */ - open class func logoutUserRaw(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func logoutUserRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/logout" - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in @@ -340,7 +340,7 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `LogoutUser` */ - open class func logoutUser(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { default: @@ -357,22 +357,22 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) - let localVariableURLString = openAPIClient.basePath + localVariablePath + let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = openAPIClient.apiClient else { - fatalError("openAPIClient.apiClient is not set.") + guard let localVariableApiClient = apiConfiguration.apiClient else { + fatalError("apiConfiguration.apiClient is not set.") } return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in try Configuration.apiWrapper(&localVariableRequest) - try localVariableRequest.content.encode(body, using: openAPIClient.contentConfiguration.requireEncoder(for: User.defaultContentType)) + try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) try beforeSend(&localVariableRequest) } @@ -392,7 +392,7 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `UpdateUser` */ - open class func updateUser(username: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + 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 switch response.status.code { case 400: 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 d2c505e66a6..b0d47e8d473 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -10,7 +10,7 @@ import FoundationNetworking #endif import Vapor -open class OpenAPIClient: @unchecked Sendable { +open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: HTTPHeaders public var apiClient: Vapor.Client? @@ -31,5 +31,5 @@ open class OpenAPIClient: @unchecked Sendable { contentConfiguration = contentConfiguration } - public static let shared = OpenAPIClient() + public static let shared = PetstoreClientAPIConfiguration() } diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/AnotherFakeAPI.md b/samples/client/petstore/swift6/vaporLibrary/docs/AnotherFakeAPI.md index 63a2a90a9db..1dd66b74db5 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/AnotherFakeAPI.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/AnotherFakeAPI.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **call123testSpecialTags** ```swift - open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` To test special tags diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/FakeAPI.md b/samples/client/petstore/swift6/vaporLibrary/docs/FakeAPI.md index 141abcefca3..0061a8e0d5c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/FakeAPI.md @@ -22,7 +22,7 @@ Method | HTTP request | Description # **createXmlItem** ```swift - open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` creates an XmlItem @@ -81,7 +81,7 @@ No authorization required # **fakeOuterBooleanSerialize** ```swift - open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -139,7 +139,7 @@ No authorization required # **fakeOuterCompositeSerialize** ```swift - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -197,7 +197,7 @@ No authorization required # **fakeOuterNumberSerialize** ```swift - open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -255,7 +255,7 @@ No authorization required # **fakeOuterStringSerialize** ```swift - open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -313,7 +313,7 @@ No authorization required # **testBodyWithFileSchema** ```swift - open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -371,7 +371,7 @@ No authorization required # **testBodyWithQueryParams** ```swift - open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` @@ -429,7 +429,7 @@ No authorization required # **testClientModel** ```swift - open class func testClientModel(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testClientModel(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` To test \"client\" model @@ -488,7 +488,7 @@ No authorization required # **testEndpointParameters** ```swift - 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + 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 ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -575,7 +575,7 @@ public enum TestEndpointParameters { # **testEnumParameters** ```swift - 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 = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + 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 ``` To test enum parameters @@ -650,7 +650,7 @@ No authorization required # **testGroupParameters** ```swift - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + 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 ``` Fake endpoint to test group parameters (optional) @@ -719,7 +719,7 @@ No authorization required # **testInlineAdditionalProperties** ```swift - open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` test inline additionalProperties @@ -776,7 +776,7 @@ No authorization required # **testJsonFormData** ```swift - open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` test json serialization of form data @@ -835,7 +835,7 @@ No authorization required # **testQueryParameterCollectionFormat** ```swift - open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + 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 ``` diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/FakeClassnameTags123API.md b/samples/client/petstore/swift6/vaporLibrary/docs/FakeClassnameTags123API.md index 386c69d6eb5..e66def6801e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/FakeClassnameTags123API.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/FakeClassnameTags123API.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **testClassname** ```swift - open class func testClassname(body: Client, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func testClassname(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` To test class name in snake case diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/vaporLibrary/docs/PetAPI.md index df095fec5b2..94bd07d558a 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/PetAPI.md @@ -17,7 +17,7 @@ Method | HTTP request | Description # **addPet** ```swift - open class func addPet(body: Pet, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func addPet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Add a new pet to the store @@ -76,7 +76,7 @@ public enum AddPet { # **deletePet** ```swift - open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Deletes a pet @@ -137,7 +137,7 @@ public enum DeletePet { # **findPetsByStatus** ```swift - open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Finds Pets by status @@ -198,7 +198,7 @@ public enum FindPetsByStatus { # **findPetsByTags** ```swift - open class func findPetsByTags(tags: Set, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func findPetsByTags(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Finds Pets by tags @@ -259,7 +259,7 @@ public enum FindPetsByTags { # **getPetById** ```swift - open class func getPetById(petId: Int64, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func getPetById(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Find pet by ID @@ -322,7 +322,7 @@ public enum GetPetById { # **updatePet** ```swift - open class func updatePet(body: Pet, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func updatePet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Update an existing pet @@ -385,7 +385,7 @@ public enum UpdatePet { # **updatePetWithForm** ```swift - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Updates a pet in the store with form data @@ -446,7 +446,7 @@ public enum UpdatePetWithForm { # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` uploads an image @@ -507,7 +507,7 @@ public enum UploadFile { # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` uploads an image (required) diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/StoreAPI.md b/samples/client/petstore/swift6/vaporLibrary/docs/StoreAPI.md index 4a439ae3cd9..ce28770583c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/StoreAPI.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/StoreAPI.md @@ -12,7 +12,7 @@ Method | HTTP request | Description # **deleteOrder** ```swift - open class func deleteOrder(orderId: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func deleteOrder(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Delete purchase order by ID @@ -73,7 +73,7 @@ No authorization required # **getInventory** ```swift - open class func getInventory(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func getInventory(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Returns pet inventories by status @@ -128,7 +128,7 @@ public enum GetInventory { # **getOrderById** ```swift - open class func getOrderById(orderId: Int64, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func getOrderById(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Find purchase order by ID @@ -191,7 +191,7 @@ No authorization required # **placeOrder** ```swift - open class func placeOrder(body: Order, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func placeOrder(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Place an order for a pet diff --git a/samples/client/petstore/swift6/vaporLibrary/docs/UserAPI.md b/samples/client/petstore/swift6/vaporLibrary/docs/UserAPI.md index 9e6d827cea8..606bba7093b 100644 --- a/samples/client/petstore/swift6/vaporLibrary/docs/UserAPI.md +++ b/samples/client/petstore/swift6/vaporLibrary/docs/UserAPI.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **createUser** ```swift - open class func createUser(body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func createUser(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Create user @@ -73,7 +73,7 @@ No authorization required # **createUsersWithArrayInput** ```swift - open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Creates list of users with given input array @@ -128,7 +128,7 @@ No authorization required # **createUsersWithListInput** ```swift - open class func createUsersWithListInput(body: [User], headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func createUsersWithListInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Creates list of users with given input array @@ -183,7 +183,7 @@ No authorization required # **deleteUser** ```swift - open class func deleteUser(username: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func deleteUser(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Delete user @@ -244,7 +244,7 @@ No authorization required # **getUserByName** ```swift - open class func getUserByName(username: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func getUserByName(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Get user by user name @@ -305,7 +305,7 @@ No authorization required # **loginUser** ```swift - open class func loginUser(username: String, password: String, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func loginUser(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Logs user into the system @@ -366,7 +366,7 @@ No authorization required # **logoutUser** ```swift - open class func logoutUser(headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func logoutUser(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Logs out current logged in user session @@ -417,7 +417,7 @@ No authorization required # **updateUser** ```swift - open class func updateUser(username: String, body: User, headers: HTTPHeaders = OpenAPIClient.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture + open class func updateUser(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture ``` Updated user